[Checkins] SVN: Sandbox/malthe/chameleon.core/ Added support for dynamic skip condition.
Malthe Borch
mborch at gmail.com
Thu Sep 25 14:23:47 EDT 2008
Log message for revision 91485:
Added support for dynamic skip condition.
Changed:
U Sandbox/malthe/chameleon.core/CHANGES.txt
U Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt 2008-09-25 18:22:55 UTC (rev 91484)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt 2008-09-25 18:23:47 UTC (rev 91485)
@@ -4,6 +4,8 @@
Head
~~~~
+- Added support for dynamic skip condition. [malthe]
+
- Fixed bug where an AttributeError would be raised when using the
file cache. [malthe]
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py 2008-09-25 18:22:55 UTC (rev 91484)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py 2008-09-25 18:23:47 UTC (rev 91485)
@@ -76,12 +76,22 @@
self.stream.scope.pop()
def body(self):
- if not self.skip:
- for element in self.element:
- element.node.update()
+ if isinstance(self.skip, types.expression):
+ assert isinstance(self.skip, types.value), \
+ "Dynamic skip condition can't be of type %s." % type(self.skip)
+ condition = clauses.Condition(types.value("not (%s)" % self.skip))
+ condition.begin(self.stream)
+ elif self.skip:
+ return
+
+ for element in self.element:
+ element.node.update()
- for element in self.element:
- element.node.visit()
+ for element in self.element:
+ element.node.visit()
+
+ if isinstance(self.skip, types.expression):
+ condition.end(self.stream)
def visit(self):
assert self.stream is not None, "Must use ``start`` method."
More information about the Checkins
mailing list