[ZPT] CVS: Zope/lib/python/Products/PageTemplates - PageTemplate.py:1.26

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


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

Modified Files:
	PageTemplate.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/Products/PageTemplates/PageTemplate.py 1.25 => 1.26 ===
--- Zope/lib/python/Products/PageTemplates/PageTemplate.py:1.25	Wed Aug 14 18:17:24 2002
+++ Zope/lib/python/Products/PageTemplates/PageTemplate.py	Sun Sep  8 22:16:26 2002
@@ -43,6 +43,11 @@
     _text = ''
     _error_start = '<!-- Page Template Diagnostics'
 
+    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 macros(self):
         return self.pt_macros()
     macros = ComputedAttribute(macros, 1)
@@ -80,7 +85,7 @@
 
         if self._v_errors:
             raise PTRuntimeError, 'Page Template %s has errors.' % self.id
-        output = StringIO()
+        output = self.StringIO()
         c = self.pt_getContext()
         c.update(extra_context)