Log message for revision 78365:
  ZopePageTemplate's pt_edit did not recognize content type arguments which had 
a charset information included.
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt  2007-07-26 20:15:50 UTC (rev 78364)
+++ Zope/branches/2.10/doc/CHANGES.txt  2007-07-26 22:04:15 UTC (rev 78365)
@@ -4,6 +4,13 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
+  Zope 2.10.5 (unreleased)
+
+    Bugs fixed
+
+      - ZopePageTemplate's pt_edit did not recognize content type arguments
+        which had a charset information included.
+
   Zope 2.10.4 (23.06.2007)
 
     Other changes

Modified: 
Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py    
2007-07-26 20:15:50 UTC (rev 78364)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py    
2007-07-26 22:04:15 UTC (rev 78365)
@@ -126,7 +126,7 @@
         encoding = None
         output_encoding = None
 
-        if content_type in ('text/xml',):
+        if content_type.startswith('text/xml'):
 
             if is_unicode:
                 encoding = None
@@ -134,9 +134,8 @@
             else:
                 encoding = encodingFromXMLPreamble(text)
                 output_encoding = 'utf-8'
-            
 
-        elif content_type in ('text/html',) :
+        elif content_type.startswith('text/html'):
 
             charset = charsetFromMetaEquiv(text)
 

Modified: 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2007-07-26 20:15:50 UTC (rev 78364)
+++ 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2007-07-26 22:04:15 UTC (rev 78365)
@@ -165,6 +165,14 @@
         self.assertEqual(zpt.read(), s)
         self.assertEqual(isinstance(zpt.read(), unicode), True)
 
+    def testEditWithContentTypeCharset(self):
+        manage_addPageTemplate(self.app, 'test', xml_utf8, encoding='utf-8')
+        zpt = self.app['test']
+        xml_unicode = unicode(xml_utf8, 'utf-8').strip()
+        zpt.pt_edit(xml_unicode, 'text/xml')
+        zpt.pt_edit(xml_unicode, 'text/xml; charset=utf-8')
+        self.assertEqual(zpt.read(), xml_unicode)
+
     def _createZPT(self):
         manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf-8')
         zpt = self.app['test']

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to