[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/tal/t A
small fix (with a test) for a trailing semicolon on i18n:attributes,
which would generate a very cryptic compilation error resulting from
an indexerror raised inside talgenerator when compiling the
page template.
Sidnei da Silva
sidnei at awkly.org
Tue Jun 22 17:01:51 EDT 2004
Log message for revision 25946:
A small fix (with a test) for a trailing semicolon on i18n:attributes, which would generate a very cryptic compilation error resulting from an indexerror raised inside talgenerator when compiling the page template.
-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/tal/talgenerator.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/tal/talgenerator.py 2004-06-22 20:26:43 UTC (rev 25945)
+++ Zope3/branches/ZopeX3-3.0/src/zope/tal/talgenerator.py 2004-06-22 21:01:51 UTC (rev 25946)
@@ -827,7 +827,11 @@
def _parseI18nAttributes(i18nattrs, position, xml):
d = {}
- for spec in i18nattrs.split(";"):
+ # Filter out empty items, eg:
+ # i18n:attributes="value msgid; name msgid2;"
+ # would result in 3 items where the last one is empty
+ attrs = filter(None, i18nattrs.split(";"))
+ for spec in attrs:
parts = spec.split()
if len(parts) > 2:
raise TALError("illegal i18n:attributes specification: %r" % spec,
Modified: Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/input/test24.html
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/input/test24.html 2004-06-22 20:26:43 UTC (rev 25945)
+++ Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/input/test24.html 2004-06-22 21:01:51 UTC (rev 25946)
@@ -7,3 +7,6 @@
<input i18n:attributes=" name message-id;
attr input-attr ">
+
+<input i18n:attributes=" name message-id;
+ attr input-attr;">
Modified: Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/output/test24.html
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/output/test24.html 2004-06-22 20:26:43 UTC (rev 25945)
+++ Zope3/branches/ZopeX3-3.0/src/zope/tal/tests/output/test24.html 2004-06-22 21:01:51 UTC (rev 25946)
@@ -3,3 +3,5 @@
<input name="MESSAGE-ID">
<input name="MESSAGE-ID" attr="INPUT-ATTR">
+
+<input name="MESSAGE-ID" attr="INPUT-ATTR">
More information about the Zope3-Checkins
mailing list