diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-09-13 15:16:15 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-09-13 15:16:15 +0200 |
| commit | 2bb30173ffd3c6ccd83a500fdfb0d458ebb26387 (patch) | |
| tree | 4ba009dee3c37cbed27f67e543e0569926a3a3b0 | |
| parent | 93cf24f73ae79cdfd0346145d0b828ebd1ea07f9 (diff) | |
[FIX] http_routing: python3 compat
In python3, exception variables are cleared at the end of the `except`
clause [1]
[1] https://docs.python.org/3/reference/compound_stmts.html#the-try-statement
| -rw-r--r-- | addons/http_routing/models/ir_http.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/http_routing/models/ir_http.py b/addons/http_routing/models/ir_http.py index 6b02e6c3321..c16eb70fdd5 100644 --- a/addons/http_routing/models/ir_http.py +++ b/addons/http_routing/models/ir_http.py @@ -287,6 +287,7 @@ class IrHttp(models.AbstractModel): request.routing_iteration = getattr(request, 'routing_iteration', 0) + 1 func = None + routing_error = None # locate the controller method try: if request.httprequest.method == 'GET' and '//' in request.httprequest.path: @@ -299,7 +300,7 @@ class IrHttp(models.AbstractModel): # either we have a language prefixed route, either a real 404 # in all cases, website processes them request.is_frontend = True - request.routing_failed = True + routing_error = e request.is_frontend_multilang = ( request.is_frontend and @@ -344,14 +345,14 @@ class IrHttp(models.AbstractModel): if request.lang != cls._get_default_lang().code: path.insert(1, request.lang) path = '/'.join(path) or '/' - request.routing_failed = False + routing_error = None redirect = request.redirect(path + '?' + request.httprequest.query_string) redirect.set_cookie('frontend_lang', request.lang) return redirect elif url_lang: request.uid = None path.pop(1) - request.routing_failed = False + routing_error = None return cls.reroute('/'.join(path) or '/') context = dict(request.context) @@ -359,8 +360,8 @@ class IrHttp(models.AbstractModel): context['edit_translations'] = False request.context = context - if getattr(request, 'routing_failed', False): - return cls._handle_exception(e) + if routing_error: + return cls._handle_exception(routing_error) # removed cache for auth public request.cache_save = False |
