changeset 562:b3dc05d88751 trunk

In the py:choose stack, store the information of whether a test expression has been supplied separate from the result of its evaluation.
author cmlenz
date Thu, 05 Jul 2007 17:49:20 +0000
parents 21b473243e63
children 9d1c5c290254
files genshi/template/directives.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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:
Copyright (C) 2012-2017 Edgewall Software