# HG changeset patch # User cmlenz # Date 1183657760 0 # Node ID 21f3c4bdd96496bbae60e59a1cb30e261c128e15 # Parent 3225bb74c6722d74984f6463631544b7ac9d8bb5 In the py:choose stack, store the information of whether a test expression has been supplied separate from the result of its evaluation. diff --git a/genshi/template/directives.py b/genshi/template/directives.py --- a/genshi/template/directives.py +++ b/genshi/template/directives.py @@ -587,9 +587,9 @@ attach = classmethod(attach) def __call__(self, stream, ctxt, directives): - info = [False, None] + info = [False, bool(self.expr), None] if self.expr: - info[1] = self.expr.evaluate(ctxt) + info[2] = self.expr.evaluate(ctxt) ctxt._choice_stack.append(info) for event in _apply_directives(stream, ctxt, directives): yield event @@ -628,7 +628,7 @@ 'must have a test expression', self.filename, *stream.next()[2][1:]) if info[1]: - value = info[1] + value = info[2] if self.expr: matched = value == self.expr.evaluate(ctxt) else: