Commit 4262f14a authored by Guido van Rossum's avatar Guido van Rossum

- Don't use z: prefix in references to TAL attributes in error

  messages.
parent be825171
...@@ -301,7 +301,7 @@ class TALCompiler(METALCompiler): ...@@ -301,7 +301,7 @@ class TALCompiler(METALCompiler):
if replace: n = n+1 if replace: n = n+1
if repeat: n = n+1 if repeat: n = n+1
if n > 1: if n > 1:
raise TALError("can't use z:insert, z:replace, z:repeat together") raise TALError("can't use insert/replace/repeat together")
ok = 0 ok = 0
if insert: if insert:
ok = self.doInsert(node, insert) ok = self.doInsert(node, insert)
......
...@@ -176,7 +176,7 @@ class TALParser(XMLParser): ...@@ -176,7 +176,7 @@ class TALParser(XMLParser):
if replace: n + n+1 if replace: n + n+1
if repeat: n = n+1 if repeat: n = n+1
if n > 1: if n > 1:
raise TALError("can't use z:insert, z:replace, z:repeat together") raise TALError("can't use insert, replace, repeat together")
if defineMacro: if defineMacro:
self.gen.pushProgram() self.gen.pushProgram()
todo["defineMacro"] = defineMacro todo["defineMacro"] = defineMacro
......
...@@ -156,7 +156,7 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -156,7 +156,7 @@ class TALVisitor(CopyingDOMVisitor):
if replace: n = n+1 if replace: n = n+1
if repeat: n = n+1 if repeat: n = n+1
if n > 1: if n > 1:
print "Please use only one of z:insert, z:replace, z:repeat" print "Please use only one of insert, replace, repeat"
ok = 0 ok = 0
if insert: if insert:
ok = self.doInsert(node, insert, attrDict) ok = self.doInsert(node, insert, attrDict)
...@@ -194,7 +194,7 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -194,7 +194,7 @@ class TALVisitor(CopyingDOMVisitor):
m = re.match( m = re.match(
r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part)
if not m: if not m:
print "Bad syntax in z:define argument:", `part` print "Bad syntax in define argument:", `part`
else: else:
scope, name, expr = m.group(1, 2, 3) scope, name, expr = m.group(1, 2, 3)
scope = scope or "local" scope = scope or "local"
...@@ -224,7 +224,7 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -224,7 +224,7 @@ class TALVisitor(CopyingDOMVisitor):
def doSubstitution(self, key, expr, attrDict): def doSubstitution(self, key, expr, attrDict):
if key == "text": if key == "text":
if attrDict: if attrDict:
print "Warning: z:attributes unused for text replacement" print "Warning: attributes unused for text replacement"
data = self.engine.evaluateText(expr) data = self.engine.evaluateText(expr)
newChild = self.newDocument.createTextNode(str(data)) newChild = self.newDocument.createTextNode(str(data))
self.curNode.appendChild(newChild) self.curNode.appendChild(newChild)
...@@ -241,15 +241,15 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -241,15 +241,15 @@ class TALVisitor(CopyingDOMVisitor):
attrDone = 1 attrDone = 1
if not attrDone: if not attrDone:
# Apparently no element nodes were inserted # Apparently no element nodes were inserted
print "Warning: z:attributes unused for struct replacement" print "Warning: attributes unused for struct replacement"
def doRepeat(self, node, arg, attrDict): def doRepeat(self, node, arg, attrDict):
if not self.newDocument: if not self.newDocument:
print "Can't have z:repeat on the documentElement" print "Can't have repeat on the documentElement"
return 0 return 0
m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg) m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg)
if not m: if not m:
print "Bad syntax in z:repeat:", `arg` print "Bad syntax in repeat:", `arg`
return 0 return 0
name, expr = m.group(1, 2) name, expr = m.group(1, 2)
iterator = self.engine.setRepeat(name, expr) iterator = self.engine.setRepeat(name, expr)
......
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