[Zope3-checkins] SVN: Zope3/trunk/src/zope/tal/talgenerator.py -
avoid variable initialization
Fred L. Drake, Jr.
fdrake at gmail.com
Thu Oct 13 15:20:18 EDT 2005
Log message for revision 39119:
- avoid variable initialization
- add a couple of minor comments
Changed:
U Zope3/trunk/src/zope/tal/talgenerator.py
-=-
Modified: Zope3/trunk/src/zope/tal/talgenerator.py
===================================================================
--- Zope3/trunk/src/zope/tal/talgenerator.py 2005-10-13 14:46:21 UTC (rev 39118)
+++ Zope3/trunk/src/zope/tal/talgenerator.py 2005-10-13 19:20:18 UTC (rev 39119)
@@ -50,9 +50,10 @@
# emitEndElement needs to finish its calculations
self.todoStack = []
self.macros = {}
+ # {slot-name --> default content program}
self.slots = {}
self.slotStack = []
- self.xml = xml
+ self.xml = xml # true --> XML, false --> HTML
self.emit("version", TAL_VERSION)
self.emit("mode", xml and "xml" or "html")
if source_file is not None:
@@ -70,10 +71,6 @@
output = []
collect = []
cursor = 0
- if self.xml:
- endsep = "/>"
- else:
- endsep = " />"
for cursor in xrange(len(program)+1):
try:
item = program[cursor]
@@ -90,6 +87,7 @@
if self.optimizeStartTag(collect, item[1], item[2], ">"):
continue
if opcode == "startEndTag":
+ endsep = self.xml and "/>" or " />"
if self.optimizeStartTag(collect, item[1], item[2], endsep):
continue
if opcode in ("beginScope", "endScope"):
More information about the Zope3-Checkins
mailing list