summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2014-06-27 12:56:24 +0200
committerOlivier Dony <odo@openerp.com>2014-06-27 13:04:31 +0200
commita7aa8537376352f56efe8139d4fa515fe52bbbee (patch)
tree070b50b1b7746c548327a6af2b444b371e43b9fb
parent7e9dfa774ec092beaa159c6874482cf7e68d9296 (diff)
[FIX] website: exception handling: let redirects pass untouched
The website module normally tries to render user-friendly error pages for any error occurring during the processing of a website-enabled request. This happens even for werkzeug's HTTPExceptions that have their own response, because we want the website layout to be applied on top of the error page. One special sort of HTTPException should be preserved without rewriting: the manually-crafted ones generated with abort(), and usually wrapping a redirect response, which bears no alteration.
-rw-r--r--addons/website/models/ir_http.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index d16077a3828..be6b4982819 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -127,6 +127,11 @@ class ir_http(orm.AbstractModel):
if isinstance(exception.qweb.get('cause'), openerp.exceptions.AccessError):
code = 403
+ if isinstance(exception, werkzeug.exceptions.HTTPException) and code is None:
+ # Hand-crafted HTTPException likely coming from abort(),
+ # usually for a redirect response -> return it directly
+ return exception
+
if code == 500:
logger.error("500 Internal Server Error:\n\n%s", values['traceback'])
if 'qweb_exception' in values: