Wrap MIME-type init into a function definition
@@ -16,6 +16,8 @@ from cherrypy._cpcompat import ntob
from cherrypy.lib import cptools, httputil, file_generator_limited
+def _setup_mimetypes():
+ """Pre-initialize global mimetype map."""
if not mimetypes.inited:
mimetypes.init()
mimetypes.types_map['.dwg'] = 'image/x-dwg'
@@ -24,6 +26,9 @@ mimetypes.types_map['.bz2'] = 'application/x-bzip2'
mimetypes.types_map['.gz'] = 'application/x-gzip'
+_setup_mimetypes()
+
+
def serve_file(path, content_type=None, disposition=None, name=None,
debug=False):
"""Set status, headers, and body in order to serve the given path.
