Commit 70b7ea26 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 32ec6e8b
...@@ -377,6 +377,9 @@ class TALGenerator: ...@@ -377,6 +377,9 @@ class TALGenerator:
repldict = parseAttributeReplacements(attrsubst) repldict = parseAttributeReplacements(attrsubst)
else: else:
repldict = {} repldict = {}
if replace:
todo["repldict"] = repldict
repldict = {}
self.emitStartTag(name, self.replaceAttrs(attrlist, repldict)) self.emitStartTag(name, self.replaceAttrs(attrlist, repldict))
if content: if content:
self.pushProgram() self.pushProgram()
...@@ -398,7 +401,8 @@ class TALGenerator: ...@@ -398,7 +401,8 @@ class TALGenerator:
self.emit("endScope") self.emit("endScope")
replace = todo.get("replace") replace = todo.get("replace")
if replace: if replace:
self.emitSubstitution(replace) repldict = todo.get("repldict", {})
self.emitSubstitution(replace, repldict)
condition = todo.get("condition") condition = todo.get("condition")
if condition: if condition:
self.emitCondition(condition) self.emitCondition(condition)
......
...@@ -92,7 +92,7 @@ import getopt ...@@ -92,7 +92,7 @@ import getopt
import cgi import cgi
from XMLParser import XMLParser from XMLParser import XMLParser
from TALDefs import quote from TALDefs import TALError, quote
BOOLEAN_HTML_ATTRS = [ BOOLEAN_HTML_ATTRS = [
# List of Boolean attributes in HTML that should be rendered in # List of Boolean attributes in HTML that should be rendered in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment