[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #151020:
HTTP_CHAR_SET headers containing 'x-user-defined'
Andreas Jung
andreas at andreas-jung.com
Sat Oct 20 07:33:36 EDT 2007
Log message for revision 80942:
- Collector #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
caused a LookupError exception. Unknown encodings are from now on
silently discarded.
Changed:
U Zope/branches/2.10/doc/CHANGES.txt
U Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
U Zope/branches/2.10/lib/python/Products/PageTemplates/unicodeconflictresolver.py
-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt 2007-10-20 10:31:27 UTC (rev 80941)
+++ Zope/branches/2.10/doc/CHANGES.txt 2007-10-20 11:33:36 UTC (rev 80942)
@@ -29,6 +29,10 @@
- Collector #2339: ZPT: fixed unicode issue when using the 'structure'
directive
+ - Collector #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
+ caused a LookupError exception. Unknown encodings are from now on
+ silently discarded.
+
Zope 2.10.4 (2007/06/23)
Other changes
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-20 10:31:27 UTC (rev 80941)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-20 11:33:36 UTC (rev 80942)
@@ -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="python: request.get(\'data\')" />',
+ encoding='ascii')
+ zpt = self.app['test']
+ self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'x-user-defined, iso-8859-15')
+ 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')), False)
class ZopePageTemplateFileTests(ZopeTestCase):
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-10-20 10:31:27 UTC (rev 80941)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-10-20 11:33:36 UTC (rev 80942)
@@ -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