[REV] Bring back QWebExceptions
bzr revid: fme@openerp.com-20140131113611-wee3xvnvzw9smq2r
This commit is contained in:
parent
fa61a1e5a7
commit
5451f5587d
|
@ -103,20 +103,16 @@ class ir_http(orm.AbstractModel):
|
||||||
traceback=traceback.format_exc(exception),
|
traceback=traceback.format_exc(exception),
|
||||||
)
|
)
|
||||||
if exception:
|
if exception:
|
||||||
current_exception = exception
|
code = getattr(exception, 'code', code)
|
||||||
if isinstance(exception, ir_qweb.QWebException):
|
if isinstance(exception, ir_qweb.QWebException):
|
||||||
values.update(qweb_exception=exception)
|
values.update(qweb_exception=exception)
|
||||||
if exception.inner:
|
if isinstance(exception.qweb.get('cause'), openerp.exceptions.AccessError):
|
||||||
current_exception = exception.inner
|
code = 403
|
||||||
if isinstance(current_exception, openerp.exceptions.AccessError):
|
|
||||||
code = 403
|
|
||||||
else:
|
|
||||||
code = getattr(exception, 'code', code)
|
|
||||||
if code == 500:
|
if code == 500:
|
||||||
logger.error("500 Internal Server Error:\n\n%s", values['traceback'])
|
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")
|
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]
|
to_reset = [v for v in views if v.model_data_id.noupdate is True]
|
||||||
values['views'] = to_reset
|
values['views'] = to_reset
|
||||||
elif code == 403:
|
elif code == 403:
|
||||||
|
@ -132,7 +128,7 @@ class ir_http(orm.AbstractModel):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
html = request.website._render('website.%s' % code, values)
|
html = request.website._render('website.%s' % code, values)
|
||||||
except:
|
except Exception:
|
||||||
html = request.website._render('website.http_error', values)
|
html = request.website._render('website.http_error', values)
|
||||||
return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8')
|
return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8')
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,10 @@
|
||||||
<div id="error_main" class="panel-collapse collapse in">
|
<div id="error_main" class="panel-collapse collapse in">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p t-if="website_controller">The following error was raised in the website controller <code t-esc="website_controller"/></p>
|
<p t-if="website_controller">The following error was raised in the website controller <code t-esc="website_controller"/></p>
|
||||||
<p><strong>Error message:</strong> <pre t-esc="exception.message"/></p>
|
<p>
|
||||||
|
<strong>Error message:</strong>
|
||||||
|
<pre t-esc="exception.message"/>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -465,12 +468,16 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="error_qweb" class="panel-collapse collapse">
|
<div id="error_qweb" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>
|
<p t-if="exception.qweb.get('message')">
|
||||||
The error occured while rendering the template <code t-esc="qweb_exception.template"/>
|
<strong>Error message:</strong>
|
||||||
<t t-if="qweb_exception.expression">and evaluating the following expression: <code t-esc="qweb_exception.expression"/></t>
|
<pre t-esc="exception.qweb.get('message')"/>
|
||||||
</p>
|
</p>
|
||||||
<t t-if="qweb_exception.node">
|
<p>
|
||||||
<pre id="exception_node" t-esc="qweb_exception.node.toxml()"/>
|
The error occured while rendering the template <code t-esc="qweb_exception.qweb.get('template')"/>
|
||||||
|
<t t-if="'expression' in qweb_exception.qweb">and evaluating the following expression: <code t-esc="qweb_exception.qweb['expression']"/></t>
|
||||||
|
</p>
|
||||||
|
<t t-if="'node' in qweb_exception.qweb">
|
||||||
|
<pre id="exception_node" t-esc="qweb_exception.qweb['node'].toxml()"/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -569,7 +576,7 @@
|
||||||
<div class="container" t-if="views">
|
<div class="container" t-if="views">
|
||||||
<div class="alert alert-danger" t-if="qweb_exception and editable">
|
<div class="alert alert-danger" t-if="qweb_exception and editable">
|
||||||
<h4>Template fallback</h4>
|
<h4>Template fallback</h4>
|
||||||
<p>An error occured while rendering the template <code t-esc="qweb_exception.template"/>.</p>
|
<p>An error occured while rendering the template <code t-esc="qweb_exception.qweb['template']"/>.</p>
|
||||||
<p>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 <strong>factory settings</strong>.</p>
|
<p>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 <strong>factory settings</strong>.</p>
|
||||||
<form action="/website/reset_templates" method="post">
|
<form action="/website/reset_templates" method="post">
|
||||||
<ul class="oe_template_fallback">
|
<ul class="oe_template_fallback">
|
||||||
|
|
Loading…
Reference in New Issue