diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 4838e650651..6948f102fec 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -103,20 +103,16 @@ class ir_http(orm.AbstractModel): traceback=traceback.format_exc(exception), ) if exception: - current_exception = exception + code = getattr(exception, 'code', code) if isinstance(exception, ir_qweb.QWebException): values.update(qweb_exception=exception) - if exception.inner: - current_exception = exception.inner - if isinstance(current_exception, openerp.exceptions.AccessError): - code = 403 - else: - code = getattr(exception, 'code', code) + if isinstance(exception.qweb.get('cause'), openerp.exceptions.AccessError): + code = 403 if code == 500: logger.error("500 Internal Server Error:\n\n%s", values['traceback']) - if values.get('qweb_exception'): + if 'qweb_exception' in values: view = request.registry.get("ir.ui.view") - views = view._views_get(request.cr, request.uid, values['qweb_exception'].template, request.context) + views = view._views_get(request.cr, request.uid, exception.qweb['template'], request.context) to_reset = [v for v in views if v.model_data_id.noupdate is True] values['views'] = to_reset elif code == 403: @@ -132,7 +128,7 @@ class ir_http(orm.AbstractModel): try: html = request.website._render('website.%s' % code, values) - except: + except Exception: html = request.website._render('website.http_error', values) return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8') diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index e34d1e5925a..c288dbacb93 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -451,7 +451,10 @@

The following error was raised in the website controller

-

Error message:

+

+ Error message: +

+                    

@@ -465,12 +468,16 @@
-

- The error occured while rendering the template - and evaluating the following expression: +

+ Error message: +

                     

- -
+                    

+ The error occured while rendering the template + and evaluating the following expression: +

+ +
                     
                 
@@ -569,7 +576,7 @@

Template fallback

-

An error occured while rendering the template .

+

An error occured while rendering the template .

If this error is caused by a change of yours in the templates, you have the possibility to reset one or more templates to their factory settings.