Commit eeb9fc52 authored by Hanno Schlichting's avatar Hanno Schlichting

ZopePageTemplate's pt_edit did not recognize content type arguments which had...

ZopePageTemplate's pt_edit did not recognize content type arguments which had a charset information included.
parent 8457b66d
......@@ -4,6 +4,13 @@ Zope Changes
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
......
......@@ -126,7 +126,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
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 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
else:
encoding = encodingFromXMLPreamble(text)
output_encoding = 'utf-8'
elif content_type in ('text/html',) :
elif content_type.startswith('text/html'):
charset = charsetFromMetaEquiv(text)
......
......@@ -165,6 +165,14 @@ class ZopePageTemplateFileTests(ZopeTestCase):
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']
......
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