Commit baf8ead2 authored by Hanno Schlichting's avatar Hanno Schlichting

Merged r78365 from 2.10 branch.

parent ff82d86a
...@@ -132,6 +132,9 @@ Zope Changes ...@@ -132,6 +132,9 @@ Zope Changes
Bugs Fixed Bugs Fixed
- ZopePageTemplate's pt_edit did not recognize content type arguments
which had a charset information included.
- "version.txt" file was being written to the wrong place by the - "version.txt" file was being written to the wrong place by the
Makefile, causing Zope to report "unreleased version" even for Makefile, causing Zope to report "unreleased version" even for
released versions. released versions.
......
...@@ -126,7 +126,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable, ...@@ -126,7 +126,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
encoding = None encoding = None
output_encoding = None output_encoding = None
if content_type in ('text/xml',): if content_type.startswith('text/xml'):
if is_unicode: if is_unicode:
encoding = None encoding = None
...@@ -135,8 +135,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable, ...@@ -135,8 +135,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
encoding = encodingFromXMLPreamble(text) encoding = encodingFromXMLPreamble(text)
output_encoding = 'utf-8' output_encoding = 'utf-8'
elif content_type.startswith('text/html'):
elif content_type in ('text/html',) :
charset = charsetFromMetaEquiv(text) charset = charsetFromMetaEquiv(text)
......
...@@ -165,6 +165,13 @@ class ZopePageTemplateFileTests(ZopeTestCase): ...@@ -165,6 +165,13 @@ class ZopePageTemplateFileTests(ZopeTestCase):
self.assertEqual(zpt.read(), s) self.assertEqual(zpt.read(), s)
self.assertEqual(isinstance(zpt.read(), unicode), True) 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): def _createZPT(self):
manage_addPageTemplate(self.app, 'test', text=utf8_str, encoding='utf-8') manage_addPageTemplate(self.app, 'test', text=utf8_str, encoding='utf-8')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment