[FIX] http_routing: fix request.redirect withtout website installed

In case you have a controller website=True without website installed, the
request.redirect() use url_for which one uses request.website_routing on the
request, without that it has been set by the website dispatcher.

closes odoo/odoo#38191

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Jeremy Kersten
2019-10-08 11:54:56 +00:00
parent 2cf3377fdb
commit 85c2a18dae
+2 -1
View File
@@ -182,7 +182,8 @@ def url_for(url_from, lang_code=None, no_rewrite=False):
new_url = False
# don't try to match route if we know that no rewrite has been loaded.
if not request.env['ir.http']._rewrite_len.get(request.website_routing):
routing = getattr(request, 'website_routing', None) # not modular, but not overridable
if not request.env['ir.http']._rewrite_len.get(routing):
no_rewrite = True
# avoid useless check for 1 char URL '/', '#', ... and absolute URL