diff options
| author | Raphael Collet <rco@openerp.com> | 2016-06-13 15:24:15 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2016-06-14 13:12:19 +0200 |
| commit | f16ce73287c8f9c46da5dc561889c4836b6740c0 (patch) | |
| tree | 52da68135d6d25f2f8ca11bc87de85c8eec33d29 | |
| parent | e1fb2bd080b45a2677993fb0ff2f40bfecdca0ee (diff) | |
[FIX] qweb: the code required non-whitespace chars betweem t-if and t-else directives
| -rw-r--r-- | openerp/addons/base/ir/ir_qweb/qweb.py | 13 |
1 files 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 |
