[FIX] qweb: correctly display qweb error message

When compiling the qweb template, if an error occurs, an error message is
displayed with the corresponding failed node.

This messsage was not always correct because the node is modified in place
during the compilation proccess.

The template is now re-read before displaying the error.
This commit is contained in:
Christophe Matthieu
2018-08-13 17:09:28 +02:00
parent 24657828b5
commit f69ebfcfe6
+1
View File
@@ -329,6 +329,7 @@ class QWeb(object):
raise e
except Exception as e:
path = _options['last_path_node']
element, document = self.get_template(template, options)
node = element.getroottree().xpath(path)
raise QWebException("Error when compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)