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

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


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

Modified Files:
      Tag: Zope-2_6-branch
	PageTemplate.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/Products/PageTemplates/PageTemplate.py 1.25 => 1.25.6.1 ===
--- 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:21:48 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)