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:
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 @@ class TALGenerator:
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)
......
......@@ -92,7 +92,7 @@ import getopt
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
......
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