[Checkins] SVN: z3c.pt/trunk/ Added missing escaping for Unicode values.

Hanno Schlichting plone at hannosch.info
Tue Jul 22 19:05:03 EDT 2008


Log message for revision 88744:
  Added missing escaping for Unicode values.
  

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/clauses.py

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2008-07-22 22:51:33 UTC (rev 88743)
+++ z3c.pt/trunk/CHANGES.txt	2008-07-22 23:05:01 UTC (rev 88744)
@@ -5,7 +5,8 @@
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 - Inline the _escape function, because function calls are expensive in Python.
-  [fschulze]
+  Added missing escaping for Unicode values.
+  [fschulze, hannosch]
 
 - When templates are instantiated outside of a class-definition, a
   relative file path will be made absolute using the module path.

Modified: z3c.pt/trunk/src/z3c/pt/clauses.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/clauses.py	2008-07-22 22:51:33 UTC (rev 88743)
+++ z3c.pt/trunk/src/z3c/pt/clauses.py	2008-07-22 23:05:01 UTC (rev 88744)
@@ -702,19 +702,18 @@
 
         stream.write("_urf = %s" % expr)
 
+        stream.write("if _urf is not None:")
+        stream.indent()
         if unicode_required_flag:
-            stream.write("if isinstance(_urf, unicode):")
+            stream.write("if not isinstance(_urf, unicode):")
             stream.indent()
-            stream.write("_write(_urf)")
+            stream.write("_urf = str(_urf)")
             stream.outdent()
-            stream.write("elif _urf is not None:")
         else:
-            stream.write("if _urf is not None:")
-        stream.indent()
+            stream.write("_urf = str(_urf)")
         if self.structure:
-            stream.write("_write(str(_urf))")
+            stream.write("_write(_urf)")
         else:
-            stream.write("_urf = str(_urf)")
             stream.write("if '&' in _urf:")
             stream.indent()
             stream.write("_urf = _urf.replace('&', '&')")



More information about the Checkins mailing list