[FIX] qweb: the code required non-whitespace chars betweem t-if and t-else directives

This commit is contained in:
Raphael Collet
2016-06-14 13:12:19 +02:00
committed by Christophe Matthieu
parent e1fb2bd080
commit f16ce73287
+7 -6
View File
@@ -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