[Zope3-checkins] CVS: Zope3/src/zope/tal - talgenerator.py:1.13.20.1

Sidnei da Silva sidnei at x3ng.com.br
Mon Mar 1 09:31:52 EST 2004


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv28245

Modified Files:
      Tag: runyaga-sip-branch
	talgenerator.py 
Log Message:
Allow a semicolon at the end of i18n:attributes. Needs a test before merging to HEAD


=== Zope3/src/zope/tal/talgenerator.py 1.13 => 1.13.20.1 ===
--- Zope3/src/zope/tal/talgenerator.py:1.13	Mon Nov  3 16:37:50 2003
+++ Zope3/src/zope/tal/talgenerator.py	Mon Mar  1 09:31:52 2004
@@ -695,7 +695,7 @@
             todo["repldict"] = repldict
             repldict = {}
         if script:
-            todo["script"] = script    
+            todo["script"] = script
         self.emitStartTag(name, self.replaceAttrs(attrlist, repldict), isend)
         if optTag:
             self.pushProgram()
@@ -706,7 +706,7 @@
         if content and varname:
             self.pushProgram()
         if script:
-            self.pushProgram()            
+            self.pushProgram()
         if todo and position != (None, None):
             todo["position"] = position
         self.todoPush(todo)
@@ -798,7 +798,7 @@
             self.emitI18nVariable(varname)
         # Do not test for "msgid is not None", i.e. we only want to test for
         # explicit msgids here.  See comment above.
-        if msgid is not None: 
+        if msgid is not None:
             # in case tal:content, i18n:translate and i18n:name in the
             # same tag insertTranslation opcode has already been
             # emitted
@@ -828,7 +828,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,




More information about the Zope3-Checkins mailing list