[Checkins] SVN: z3c.pt/trunk/ Don't generate empty mappings for expressions with a trailing semicolon.

Hanno Schlichting plone at hannosch.info
Sat Jun 14 05:44:21 EDT 2008


Log message for revision 87388:
  Don't generate empty mappings for expressions with a trailing semicolon.
  

Changed:
  U   z3c.pt/trunk/docs/HISTORY.txt
  U   z3c.pt/trunk/src/z3c/pt/expressions.py

-=-
Modified: z3c.pt/trunk/docs/HISTORY.txt
===================================================================
--- z3c.pt/trunk/docs/HISTORY.txt	2008-06-14 09:40:47 UTC (rev 87387)
+++ z3c.pt/trunk/docs/HISTORY.txt	2008-06-14 09:44:21 UTC (rev 87388)
@@ -4,6 +4,8 @@
 Version 0.8.x
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+- Don't generate empty mappings for expressions with a trailing semicolon.
+
 - Fixed undefined name 'static' error in i18n attributes handling and added
   quoting to i18n attributes.
 

Modified: z3c.pt/trunk/src/z3c/pt/expressions.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/expressions.py	2008-06-14 09:40:47 UTC (rev 87387)
+++ z3c.pt/trunk/src/z3c/pt/expressions.py	2008-06-14 09:44:21 UTC (rev 87388)
@@ -102,9 +102,15 @@
           >>> mapping("abc def")
           mapping(('abc', 'def'),)
 
+          >>> mapping("abc def;")
+          mapping(('abc', 'def'),)
+
           >>> mapping("abc")
           mapping(('abc', None),)
 
+          >>> mapping("abc;")
+          mapping(('abc', None),)
+
           >>> mapping("abc; def ghi")
           mapping(('abc', None), ('def', 'ghi'))
 
@@ -114,6 +120,9 @@
         mappings = []
         for d in defs:
             d = d.strip()
+            if d == '':
+                continue
+
             while '  ' in d:
                 d = d.replace('  ', ' ')
 



More information about the Checkins mailing list