summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-03-10 18:31:21 +0100
committerChristophe Simonis <chs@odoo.com>2017-03-10 18:31:21 +0100
commitc9e3d93ad0126039a8ae7e22610dfe256315b341 (patch)
tree1719f1a669766f3ce8c8269f4f36f8e0f4295152
parentbeaea311e6becd65dbb29925ba56016d4c249a68 (diff)
[FIX] website: correct redirect with correct lang
When forcing another language that the current one (the cookie one) in an url, the requested lang wasn't set correctly in redirect url, but the cookie was, resulting in multiple redirect which ends with initial lang. A side effect of this error was the inability to edit website page when default lang is not en_US and user not in default lang. The request context must be reset before being used by `request.redirect` (in `url_for` method).
-rw-r--r--addons/website/models/ir_http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index b69f9417ac2..a1d19f016b4 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -196,9 +196,9 @@ class Http(models.AbstractModel):
if request.lang != request.website.default_lang_code:
path.insert(1, request.lang)
path = '/'.join(path) or '/'
+ request.context = context
redirect = request.redirect(path + '?' + request.httprequest.query_string)
redirect.set_cookie('website_lang', request.lang)
- request.context = context
return redirect
elif url_lang:
request.uid = None