[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:
parent
dc7821ab8f
commit
e00c236693
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue