[ZPT] CVS: Packages/TAL - TALGenerator.py:1.42

fred@digicool.com fred@digicool.com
Fri, 8 Jun 2001 16:51:10 -0400 (EDT)


Update of /cvs-repository/Packages/TAL
In directory korak.digicool.com:/tmp/cvs-serv20649

Modified Files:
	TALGenerator.py 
Log Message:

Changing the bytecode slightly once again:

For startTag and startEndTag instructions that cannot be optimized away,
"normal" attributes are now represented by their rendered form, allowing
TALInterpreter.do_startTag() to do less work when it can be done ahead of
time.



--- Updated File TALGenerator.py in package Packages/TAL --
--- TALGenerator.py	2001/06/08 19:17:04	1.41
+++ TALGenerator.py	2001/06/08 20:51:10	1.42
@@ -158,17 +158,26 @@
         if not attrlist:
             collect.append("<%s%s" % (name, end))
             return 1
+        opt = 1
         new = ["<" + name]
-        for item in attrlist:
+        for i in range(len(attrlist)):
+            item = attrlist[i]
             if len(item) > 2:
-                return 0
+                opt = 0
+            else:
+                if item[1] is None:
+                    s = item[0]
+                else:
+                    s = "%s=%s" % (item[0], quote(item[1]))
+                attrlist[i] = item[0], s
             if item[1] is None:
                 new.append(" " + item[0])
             else:
                 new.append(" %s=%s" % (item[0], quote(item[1])))
-        new.append(end)
-        collect.extend(new)
-        return 1
+        if opt:
+            new.append(end)
+            collect.extend(new)
+        return opt
 
     def todoPush(self, todo):
         self.todoStack.append(todo)