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

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


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

Modified Files:
	TALInterpreter.py 
Log Message:
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.70 ===
--- 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:16:26 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)