[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py Only begin and end condition clause if there the element actually contains children.

Malthe Borch mborch at gmail.com
Thu Sep 25 17:05:00 EDT 2008


Log message for revision 91488:
  Only begin and end condition clause if there the element actually contains children.

Changed:
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py

-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-09-25 20:33:24 UTC (rev 91487)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-09-25 21:04:59 UTC (rev 91488)
@@ -80,7 +80,8 @@
             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)
+            if len(self.element):
+                condition.begin(self.stream)
         elif self.skip:
             return
         
@@ -91,7 +92,8 @@
             element.node.visit()
 
         if isinstance(self.skip, types.expression):
-            condition.end(self.stream)
+            if len(self.element):
+                condition.end(self.stream)
                     
     def visit(self):
         assert self.stream is not None, "Must use ``start`` method."



More information about the Checkins mailing list