From f16ce73287c8f9c46da5dc561889c4836b6740c0 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 13 Jun 2016 15:24:15 +0200 Subject: [PATCH] [FIX] qweb: the code required non-whitespace chars betweem t-if and t-else directives --- openerp/addons/base/ir/ir_qweb/qweb.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb/qweb.py b/openerp/addons/base/ir/ir_qweb/qweb.py index 34026927554..e17bf290cd8 100644 --- a/openerp/addons/base/ir/ir_qweb/qweb.py +++ b/openerp/addons/base/ir/ir_qweb/qweb.py @@ -1017,12 +1017,13 @@ class QWeb(object): def _compile_directive_if(self, el, options): orelse = [] - if el.tail and re.search(r'\S', el.tail): - next = el.getnext() - if next is not None and 't-else' in next.attrib: - el.tail = None - orelse = self._compile_node(next, dict(options, t_if=True)) - next.getparent().remove(next) + next_el = el.getnext() + if next_el is not None and 't-else' in next_el.attrib: + if el.tail and not el.tail.isspace(): + raise ValueError("Unexpected non-whitespace characters between t-if and t-else directives") + el.tail = None + orelse = self._compile_node(next_el, dict(options, t_if=True)) + next_el.getparent().remove(next_el) return [ # if $t-if: # next tag directive