[Zope3-checkins] CVS: Zope3/src/zope/tal - talinterpreter.py:1.17

Fred L. Drake, Jr. fred@zope.com
Tue, 8 Apr 2003 13:15:48 -0400


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

Modified Files:
	talinterpreter.py 
Log Message:
Remove dependence on external cgi.escape() function, which is (very
slightly) more complex than we actually need.


=== Zope3/src/zope/tal/talinterpreter.py 1.16 => 1.17 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.16	Tue Apr  8 13:01:17 2003
+++ Zope3/src/zope/tal/talinterpreter.py	Tue Apr  8 13:15:48 2003
@@ -20,7 +20,6 @@
 import sys
 import logging
 
-from cgi import escape
 # Do not use cStringIO here!  It's not unicode aware. :(
 from StringIO import StringIO
 
@@ -472,7 +471,9 @@
         if text is self.Default:
             self.interpret(stuff[1])
             return
-        s = escape(text)
+        # '&' must be done first!
+        s = text.replace(
+            "&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
         self._stream_write(s)
         i = s.rfind('\n')
         if i < 0: