Sat Dec 24 15:06:57 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Move the mimetypes import to the function.
While it's a nice practise to put all imports above, in darcsweb's case it
also increases startup latency.
Because the mimetypes module is only used inside print_binary_header(), move
the import inside the function.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-19 06:39:55.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-19 06:39:55.000000000 +0000
@@ -20,7 +20,6 @@
import xml.sax
from xml.sax.saxutils import escape as xml_escape
import email.Utils
-import mimetypes
iso_datetime = '%Y-%m-%dT%H:%M:%SZ'
@@ -397,6 +396,7 @@
print "Content-type: text/plain; charset=utf-8\n"
def print_binary_header(fname = None):
+ import mimetypes
if fname :
(mime, enc) = mimetypes.guess_type(fname)
else :