[Zope-Checkins] SVN: Zope/trunk/ - Launchpad #151020: HTTP_CHAR_SET
headers containing 'x-user-defined'
Andreas Jung
andreas at andreas-jung.com
Sat Oct 20 07:37:00 EDT 2007
Log message for revision 80943:
- Launchpad #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
caused a LookupError exception. Unknown encodings are from now on
silently discarded.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
U Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2007-10-20 11:33:36 UTC (rev 80942)
+++ Zope/trunk/doc/CHANGES.txt 2007-10-20 11:36:59 UTC (rev 80943)
@@ -175,6 +175,10 @@
Bugs Fixed
+ - Launchpad #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
+ caused a LookupError exception. Unknown encodings are from now on
+ silently discarded.
+
- Launchpad #143902: Fixed App.ImageFile to use a stream iterator to
output the file. Avoid loading the file content when guessing the
mimetype and only load the first 1024 bytes of the file when it cannot
Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-20 11:33:36 UTC (rev 80942)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-20 11:36:59 UTC (rev 80943)
@@ -131,6 +131,15 @@
result = zpt.pt_render()
self.assertEqual(result.startswith(unicode('<div>üöä</div>', 'iso-8859-15')), True)
+ def testBug151020(self):
+ manage_addPageTemplate(self.app, 'test',
+ text='<div tal:content="structure python: %s" />' % "'üöä'",
+ encoding='iso-8859-15')
+ zpt = self.app['test']
+ self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'x-user-defined, iso-8859-15,utf-8')
+ self.app.REQUEST.set('data', unicode('üöä', 'iso-8859-15').encode('utf-8'))
+ result = zpt.pt_render()
+ self.assertEqual(result.startswith(unicode('<div>üöä</div>', 'iso-8859-15')), True)
class ZopePageTemplateFileTests(ZopeTestCase):
Modified: Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-10-20 11:33:36 UTC (rev 80942)
+++ Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-10-20 11:36:59 UTC (rev 80943)
@@ -84,7 +84,7 @@
try:
return unicode(text, enc)
- except UnicodeDecodeError:
+ except (LookupError, UnicodeDecodeError):
pass
return text
More information about the Zope-Checkins
mailing list