[Checkins] SVN: Sandbox/malthe/chameleon.core/ Fixed bugs where a condition and a loop would conflict if no clauses were present (e.g. a text-only node).
Malthe Borch
mborch at gmail.com
Thu Oct 2 15:43:17 EDT 2008
Log message for revision 91670:
Fixed bugs where a condition and a loop would conflict if no clauses were present (e.g. a text-only node).
Changed:
U Sandbox/malthe/chameleon.core/CHANGES.txt
U Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py
-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt 2008-10-02 19:41:42 UTC (rev 91669)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt 2008-10-02 19:43:17 UTC (rev 91670)
@@ -4,6 +4,9 @@
head
~~~~
+- Fixed bugs related to temporary variables with loops and
+ conditions. [malthe]
+
- Set default value for `auto-reload` based on the CHAMELEON_DEBUG
environment variable check. [malthe]
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py 2008-10-02 19:41:42 UTC (rev 91669)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py 2008-10-02 19:43:17 UTC (rev 91670)
@@ -368,19 +368,23 @@
if self.finalize:
for clause in reversed(self.clauses):
clause.end(stream)
+ stream.restore()
stream.outdent()
-
+ elif self.finalize:
+ stream.restore()
+
def end(self, stream):
- temp = stream.restore()
-
if self.clauses:
if not self.finalize:
+ temp = stream.restore()
stream.write("if %s:" % temp)
stream.indent()
for clause in reversed(self.clauses):
clause.end(stream)
stream.outdent()
else:
+ if not self.finalize:
+ stream.restore()
stream.outdent()
self.assign.end(stream)
@@ -869,7 +873,7 @@
''
"""
- def begin(self, stream):
+ def write(self, stream):
temp = stream.save()
if self.value:
@@ -879,7 +883,12 @@
expr = temp
stream.write("%s(%s)" % (stream.symbols.write, expr))
+
+ if not self.value:
+ self.assign.end(stream)
+ stream.restore()
+
class Out(object):
"""
>>> from chameleon.core import testing
More information about the Checkins
mailing list