[FIX] exception rendering with pretty printed XML

had not been migrated to lxml
This commit is contained in:
Xavier Morel 2014-07-14 13:42:29 +02:00
parent 8472ee9f45
commit 7c540bc4ee
2 changed files with 5 additions and 1 deletions

View File

@ -507,7 +507,7 @@
<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()"/>
<pre id="exception_node" t-esc="qweb_exception.pretty_xml()"/>
</t>
</div>
</div>

View File

@ -40,6 +40,10 @@ class QWebException(Exception):
def __init__(self, message, **kw):
Exception.__init__(self, message)
self.qweb = dict(kw)
def pretty_xml(self):
if 'node' not in self.qweb:
return ''
return etree.tostring(self.qweb['node'], pretty_print=True)
class QWebTemplateNotFound(QWebException):
pass