Commit caded7fd authored by Guido van Rossum's avatar Guido van Rossum

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

  messages.

- Fix splitParts() to lose the last part if it's empty.
parent 788c58ca
...@@ -125,11 +125,11 @@ def parseAttributeReplacements(arg): ...@@ -125,11 +125,11 @@ def parseAttributeReplacements(arg):
for part in splitParts(arg): for part in splitParts(arg):
m = _attr_re.match(part) m = _attr_re.match(part)
if not m: if not m:
print "Bad syntax in z:attributes:", `part` print "Bad syntax in attributes:", `part`
continue continue
name, expr = m.group(1, 2) name, expr = m.group(1, 2)
if dict.has_key(name): if dict.has_key(name):
print "Duplicate attribute name in z:attributes:", `part` print "Duplicate attribute name in attributes:", `part`
continue continue
dict[name] = expr dict[name] = expr
return dict return dict
...@@ -137,7 +137,7 @@ def parseAttributeReplacements(arg): ...@@ -137,7 +137,7 @@ def parseAttributeReplacements(arg):
def parseSubstitution(arg): def parseSubstitution(arg):
m = _subst_re.match(arg) m = _subst_re.match(arg)
if not m: if not m:
print "Bad syntax in z:insert/replace:", `arg` print "Bad syntax in insert/replace:", `arg`
return None, None return None, None
key, expr = m.group(1, 2) key, expr = m.group(1, 2)
if not key: if not key:
...@@ -151,6 +151,8 @@ def splitParts(arg): ...@@ -151,6 +151,8 @@ def splitParts(arg):
arg = string.replace(arg, ";;", "\0") arg = string.replace(arg, ";;", "\0")
parts = string.split(arg, ';') parts = string.split(arg, ';')
parts = map(lambda s, repl=string.replace: repl(s, "\0", ";;"), parts) parts = map(lambda s, repl=string.replace: repl(s, "\0", ";;"), parts)
if len(parts) > 1 and not string.strip(parts[-1]):
del parts[-1] # It ended in a semicolon
return parts return parts
......
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