[ZPT] CVS: Packages/TAL - TALGenerator.py:1.21 TALInterpreter.py:1.22

guido@digicool.com guido@digicool.com
Fri, 16 Mar 2001 23:06:53 -0500 (EST)


Update of /cvs-repository/Packages/TAL
In directory korak:/tmp/cvs-serv7151

Modified Files:
	TALGenerator.py TALInterpreter.py 
Log Message:
This afternoon, Tim & I struggled in vain to create an example that
would trigger the error "replace structure with attribute replacements
not yet implemented".  We were right that it needed testing --
TALError was not imported.

Fixing this in TALInterpreter.py, and adding code to TALGenerator.py
that passes the "repldict" variable from emitStartElement() to
emitEndElement(), through the "todo" variable, when a "replace"
command is present.




--- Updated File TALGenerator.py in package Packages/TAL --
--- TALGenerator.py	2001/03/17 03:56:27	1.20
+++ TALGenerator.py	2001/03/17 04:06:53	1.21
@@ -377,6 +377,9 @@
             repldict = parseAttributeReplacements(attrsubst)
         else:
             repldict = {}
+        if replace:
+            todo["repldict"] = repldict
+            repldict = {}
         self.emitStartTag(name, self.replaceAttrs(attrlist, repldict))
         if content:
             self.pushProgram()
@@ -398,7 +401,8 @@
             self.emit("endScope")
         replace = todo.get("replace")
         if replace:
-            self.emitSubstitution(replace)
+            repldict = todo.get("repldict", {})
+            self.emitSubstitution(replace, repldict)
         condition = todo.get("condition")
         if condition:
             self.emitCondition(condition)

--- Updated File TALInterpreter.py in package Packages/TAL --
--- TALInterpreter.py	2001/03/16 21:50:43	1.21
+++ TALInterpreter.py	2001/03/17 04:06:53	1.22
@@ -92,7 +92,7 @@
 import cgi
 
 from XMLParser import XMLParser
-from TALDefs import quote
+from TALDefs import TALError, quote
 
 BOOLEAN_HTML_ATTRS = [
     # List of Boolean attributes in HTML that should be rendered in