[ZPT] CVS: Zope/lib/python/TAL - TALInterpreter.py:1.69.6.1

Florent Guillaume fg@nuxeo.com
Sun, 8 Sep 2002 22:21:49 -0400


Update of /cvs-repository/Zope/lib/python/TAL
In directory cvs.zope.org:/tmp/cvs-serv16794/TAL

Modified Files:
      Tag: Zope-2_6-branch
	TALInterpreter.py 
Log Message:
Backport from HEAD:
Provide an opportunity for third-party products to use a full
Unicode-aware StringIO by monkey-patching two appropriate methods
until one is completely integrated into Zope.


=== Zope/lib/python/TAL/TALInterpreter.py 1.69 => 1.69.6.1 ===
--- Zope/lib/python/TAL/TALInterpreter.py:1.69	Wed Aug 14 17:58:54 2002
+++ Zope/lib/python/TAL/TALInterpreter.py	Sun Sep  8 22:21:48 2002
@@ -114,6 +114,11 @@
         self.scopeLevel = 0
         self.sourceFile = None
 
+    def StringIO(self):
+        # Third-party products wishing to provide a full Unicode-aware
+        # StringIO can do so by monkey-patching this method.
+        return StringIO()
+
     def saveState(self):
         return (self.position, self.col, self.stream,
                 self.scopeLevel, self.level)
@@ -319,7 +324,7 @@
 
     def no_tag(self, start, program):
         state = self.saveState()
-        self.stream = stream = StringIO()
+        self.stream = stream = self.StringIO()
         self._stream_write = stream.write
         self.interpret(start)
         self.restoreOutputState(state)
@@ -565,7 +570,7 @@
 
     def do_onError_tal(self, (block, handler)):
         state = self.saveState()
-        self.stream = stream = StringIO()
+        self.stream = stream = self.StringIO()
         self._stream_write = stream.write
         try:
             self.interpret(block)