From a7aa8537376352f56efe8139d4fa515fe52bbbee Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 27 Jun 2014 12:56:24 +0200 Subject: [PATCH] [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. --- addons/website/models/ir_http.py | 5 +++++ 1 file changed, 5 insertions(+) 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: