From 8224db135a80e071e3315e0e6973df3e7ac5c1ee Mon Sep 17 00:00:00 2001 From: fpeters <> Date: Mon, 22 Dec 2003 15:37:17 +0000 Subject: [PATCH] =?UTF-8?q?Je=20n'arrive=20pas=20=C3=A0=20isoler=20le=20ch?= =?UTF-8?q?angement=20qui=20cause=20=C3=A7a,=20peut-=C3=AAtre=20dans=20mod?= =?UTF-8?q?python=20ou=20dans=20ma=20conf=20d'apache,=20mais=20les=20fichi?= =?UTF-8?q?ers=20statiques=20ne=20se=20voyaient=20plus=20servis=20avec=20l?= =?UTF-8?q?e=20bon=20type=20mime.=20=20Ce=20qui=20faisait=20que=20les=20CS?= =?UTF-8?q?S=20n'=C3=A9taient=20pas=20utilis=C3=A9es=20(Gecko=20ignore=20l?= =?UTF-8?q?es=20fichiers=20dont=20le=20type=20n'est=20pas=20text/css).=20M?= =?UTF-8?q?odif=20l=C3=A9g=C3=A8re=20pour=20s'en=20sortir.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- glasnost-web/code/webhandler.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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)