[FIX] web: redirect with hash always use html redirect

# Most IE and Safari versions decided not to preserve location.hash upon
# redirect. And even if IE10 pretends to support it, it still fails
# inexplicably in case of multiple redirects (and we do have some).
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/

bzr revid: dle@openerp.com-20140108105307-8dzzkxvtesb5d813
This commit is contained in:
Denis Ledoux 2014-01-08 11:53:07 +01:00
parent dc7821ab8f
commit e00c236693
1 changed files with 5 additions and 8 deletions

View File

@ -129,14 +129,11 @@ def db_monodb(req):
return db_redirect(req, True)[0]
def redirect_with_hash(req, url, code=303):
if req.httprequest.user_agent.browser == 'msie':
try:
version = float(req.httprequest.user_agent.version)
if version < 10:
return "<html><head><script>window.location = '%s#' + location.hash;</script></head></html>" % url
except Exception:
pass
return werkzeug.utils.redirect(url, code)
# Most IE and Safari versions decided not to preserve location.hash upon
# redirect. And even if IE10 pretends to support it, it still fails
# inexplicably in case of multiple redirects (and we do have some).
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % url
def module_topological_sort(modules):
""" Return a list of module names sorted so that their dependencies of the