[Checkins] SVN: z3c.pt/trunk/ Simplified the generated _escape code. cgi.escape's second argument is a simple boolean and not a list of characters to quote.

Hanno Schlichting plone at hannosch.info
Sun Jun 15 14:18:41 EDT 2008


Log message for revision 87413:
  Simplified the generated _escape code. cgi.escape's second argument is a simple boolean and not a list of characters to quote.
  

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

-=-
Modified: z3c.pt/trunk/docs/HISTORY.txt
===================================================================
--- z3c.pt/trunk/docs/HISTORY.txt	2008-06-15 18:08:30 UTC (rev 87412)
+++ z3c.pt/trunk/docs/HISTORY.txt	2008-06-15 18:18:40 UTC (rev 87413)
@@ -4,6 +4,9 @@
 Version 0.8.x
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+- Simplified the generated _escape code. cgi.escape's second argument is a
+  simple boolean and not a list of characters to quote.
+
 - Use a simple list based BufferIO class instead of a cStringIO for the out
   stream. Avoiding the need to encode Unicode data is a bigger win. We do
   not support arbitrarily mixing of Unicode and non-ascii inside the engine.

Modified: z3c.pt/trunk/src/z3c/pt/clauses.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/clauses.py	2008-06-15 18:08:30 UTC (rev 87412)
+++ z3c.pt/trunk/src/z3c/pt/clauses.py	2008-06-15 18:18:40 UTC (rev 87413)
@@ -489,21 +489,18 @@
             if unicode_required_flag:
                 stream.write("if isinstance(%s, unicode):" % temp)
                 stream.indent()
-                stream.write("_write(' %s=\"'+_escape("
-                             "%s, \"\\\"\")+'\"')" %
+                stream.write("_write(' %s=\"'+_escape(%s,True)+'\"')" %
                              (attribute, temp))
                 stream.outdent()
                 stream.write("elif %s is not None:" % temp)
                 stream.indent()
-                stream.write("_write(' %s=\"'+_escape("
-                             "str(%s), \"\\\"\")+'\"')" %
+                stream.write("_write(' %s=\"'+_escape(str(%s),True)+'\"')" %
                              (attribute, temp))
                 stream.outdent()
             else:
                 stream.write("if %s is not None:" % temp)
                 stream.indent()
-                stream.write("_write(' %s=\"'+_escape("
-                             "str(%s), \"\\\"\")+'\"')" %
+                stream.write("_write(' %s=\"'+_escape(str(%s),True)+'\"')" %
                              (attribute, temp))
                 stream.outdent()
 



More information about the Checkins mailing list