From bf7f9a0ee71caf8170e430d6578b5a7538b950d5 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 10 Sep 2012 12:24:03 +0200 Subject: [PATCH] [FIX] problem with mime types of fonts bzr revid: nicolas.vanhoren@openerp.com-20120910102403-qiazec8parg0i5gy --- addons/web/common/http.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 6dc99f2c997..2d3452556a8 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -420,7 +420,7 @@ def session_context(request, storage_path, session_cookie='httpsessionid'): #---------------------------------------------------------- # OpenERP Web WSGI Application #---------------------------------------------------------- -class DisableCacheMiddleware(object): +class CustomStaticMiddleware(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): @@ -431,8 +431,11 @@ class DisableCacheMiddleware(object): new_headers = [] unwanted_keys = ['Last-Modified'] + if environ.get('PATH_INFO', '').endswith(".ttf"): + new_headers.append(("Content-Type", "application/x-font-ttf")) + unwanted_keys += ["Content-Type"] if debug: - new_headers = [('Cache-Control', 'no-cache')] + new_headers.append(('Cache-Control', 'no-cache')) unwanted_keys += ['Expires', 'Etag', 'Cache-Control'] for k, v in headers: @@ -477,7 +480,7 @@ class Root(object): static_dirs = self._load_addons() if options.serve_static: app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs) - self.dispatch = DisableCacheMiddleware(app) + self.dispatch = CustomStaticMiddleware(app) if options.session_storage: if not os.path.exists(options.session_storage):