diff --git a/glasnost-web/code/webhandler.py b/glasnost-web/code/webhandler.py index f0f95351..e7d1e878 100644 --- a/glasnost-web/code/webhandler.py +++ b/glasnost-web/code/webhandler.py @@ -377,6 +377,14 @@ class Application(applications.Application): if not webFileExtension in ['tal', 'py', 'xtal'] \ and webFileName != 'index': + mimeTypes = { '.css': 'text/css', + '.jpeg': 'image/jpeg', + '.png': 'image/png' } + mimeType = None + for k, v in mimeTypes.items(): + if httpPath.endswith(k): + mimeType = v + break for path in context.getVar('webDirectoryPaths'): fileName = os.path.join(path, httpPath[1:]) if os.path.exists(fileName): @@ -388,7 +396,7 @@ class Application(applications.Application): return HTTP_FORBIDDEN lastModTime = time.gmtime(os.stat(staticFilePath)[-2]) return self.outputStaticFile( - req, staticFile.read(), lastModTime) + req, staticFile.read(), lastModTime, mimeType) args = {} context.setVar('keywordsArguments', args)