diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-07-17 16:55:25 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-07-17 16:55:25 +0200 |
| commit | 8f247dcab52a89172855dc2a14d2a7d4fdae351b (patch) | |
| tree | a13a9e4a76e5b6ded24812e96cd942b6e9a89545 /addons/web | |
| parent | a3aad2fe1c2c6ad4f7f6a73d06ec2c8289c93379 (diff) | |
[IMP] improved static files delivery
bzr revid: nicolas.vanhoren@openerp.com-20120717145525-hfs15vizjdzdwuht
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/common/http.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/common/http.py b/addons/web/common/http.py index a1d28536cd4..cd17f5711e0 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -557,10 +557,15 @@ class Root(object): return None class SuperSharedDataMiddleware(werkzeug.wsgi.SharedDataMiddleware): + """Redefine SharedDataMiddleware to better handle the cache = False directive. + Also desactivate 304 Not Modified headers only when the referer has 'debug' in its + arguments. + """ def __call__(self, environ, start_response): import os import mimetypes import werkzeug.http + import urlparse # sanitize the path for non unix systems cleaned_path = environ.get('PATH_INFO', '').strip('/') for sep in os.sep, os.altsep: @@ -602,7 +607,11 @@ class SuperSharedDataMiddleware(werkzeug.wsgi.SharedDataMiddleware): else: headers.append(('Cache-Control', 'no-cache')) - if not modified: + referer = environ.get('HTTP_REFERER', '') + parsed = urlparse.urlparse(referer) + debug = not urlparse.parse_qs(parsed.query).has_key('debug') + # it's important to put it at the end + if not debug and not modified: f.close() start_response('304 Not Modified', headers) return [] |
