[FIX] problem with mime types of fonts

bzr revid: nicolas.vanhoren@openerp.com-20120910102403-qiazec8parg0i5gy
This commit is contained in:
niv-openerp
2012-09-10 12:24:03 +02:00
parent 7710eef0b2
commit bf7f9a0ee7
+6 -3
View File
@@ -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):