[ZPT] CVS: Zope/lib/python/Products/PageTemplates - PageTemplate.py:1.25.4.1 PageTemplateFile.py:1.19.4.1

Chris McDonough chrism@zope.com
Tue, 10 Sep 2002 23:37:07 -0400


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

Modified Files:
      Tag: chrism-install-branch
	PageTemplate.py PageTemplateFile.py 
Log Message:
Merging chrism-install-branch with HEAD changes.


=== Zope/lib/python/Products/PageTemplates/PageTemplate.py 1.25 => 1.25.4.1 ===
--- Zope/lib/python/Products/PageTemplates/PageTemplate.py:1.25	Wed Aug 14 18:17:24 2002
+++ Zope/lib/python/Products/PageTemplates/PageTemplate.py	Tue Sep 10 23:36:36 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)
 
@@ -126,7 +131,7 @@
     def write(self, text):
         assert type(text) is type('')
         if text[:len(self._error_start)] == self._error_start:
-            errend = find(text, '-->')
+            errend = text.find('-->')
             if errend >= 0:
                 text = text[errend + 4:]
         if self._text != text:


=== Zope/lib/python/Products/PageTemplates/PageTemplateFile.py 1.19 => 1.19.4.1 ===
--- Zope/lib/python/Products/PageTemplates/PageTemplateFile.py:1.19	Wed Aug 14 18:17:24 2002
+++ Zope/lib/python/Products/PageTemplates/PageTemplateFile.py	Tue Sep 10 23:36:36 2002
@@ -82,8 +82,9 @@
         bound_names['options'] = kw
 
         try:
-            self.REQUEST.RESPONSE.setHeader('content-type',
-                                            self.content_type)
+            response = self.REQUEST.RESPONSE
+            if not response.headers.has_key('content-type'):
+                response.setHeader('content-type', self.content_type)
         except AttributeError: pass
 
         # Execute the template in a new security context.