diff markup/template.py @ 120:c9f0a26e28a2 trunk

* Allow `py:with` directives to define `lambda`s * Fix directive order so that a `py:for` loop can be used inside a `py:when` or `py:otherwise` branch.
author cmlenz
date Wed, 02 Aug 2006 11:56:31 +0000
parents c77c113846d6
children 79f445396cd7
line wrap: on
line diff
--- a/markup/template.py
+++ b/markup/template.py
@@ -648,7 +648,7 @@
                                       offset + (err.offset or 0))
 
     def __call__(self, stream, ctxt, directives):
-        ctxt.push(dict([(name, expr.evaluate(ctxt))
+        ctxt.push(dict([(name, expr.evaluate(ctxt, nocall=True))
                         for name, expr in self.vars]))
         for event in _apply_directives(stream, ctxt, directives):
             yield event
@@ -671,10 +671,10 @@
 
     directives = [('def', DefDirective),
                   ('match', MatchDirective),
+                  ('when', WhenDirective),
+                  ('otherwise', OtherwiseDirective),
                   ('for', ForDirective),
                   ('if', IfDirective),
-                  ('when', WhenDirective),
-                  ('otherwise', OtherwiseDirective),
                   ('choose', ChooseDirective),
                   ('with', WithDirective),
                   ('replace', ReplaceDirective),
Copyright (C) 2012-2017 Edgewall Software