[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2208: rewriting/setting the 'charset' part of the content-type
Log message for revision 70564: - Collector #2208: rewriting/setting the 'charset' part of the content-type HTTP header will be done only for 'text/*' Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py U Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-10-08 06:16:21 UTC (rev 70563) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-10-08 08:30:16 UTC (rev 70564) @@ -4,6 +4,14 @@ Change information for previous versions of Zope can be found in the file HISTORY.txt. + Zope 2.10.0 (unreleased) + +Bugs fixed + + - Collector #2208: rewriting/setting the 'charset' part of the content-type +HTTP header will be done only for 'text/*' + + Zope 2.10.0 (2006/10/04) Bugs fixed Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py === --- Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py2006-10-08 06:16:21 UTC (rev 70563) +++ Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py2006-10-08 08:30:16 UTC (rev 70564) @@ -343,7 +343,7 @@ self.setHeader('content-type', c) else: c = self.headers['content-type'] -if not 'charset=' in c: +if c.startswith('text/') and not 'charset=' in c: c = '%s; charset=%s' % (c, default_encoding) self.setHeader('content-type', c) Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py === --- Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-10-08 06:16:21 UTC (rev 70563) +++ Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-10-08 08:30:16 UTC (rev 70564) @@ -94,11 +94,17 @@ self.assertEqual(response.headers.get('content-type'), 'text/plain; charset=iso-8859-15') -def test_charset_application_header(self): +def test_charset_application_header_no_header(self): response = self._makeOne(body='foo', headers={'content-type': 'application/foo'}) self.assertEqual(response.headers.get('content-type'), - 'application/foo; charset=iso-8859-15') + 'application/foo') + +def test_charset_application_header_with_header(self): +response = self._makeOne(body='foo', +headers={'content-type': 'application/foo; charset: something'}) +self.assertEqual(response.headers.get('content-type'), + 'application/foo; charset: something') def test_charset_application_header_unicode(self): response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), @@ -117,9 +123,9 @@ def test_XMLEncodingRecoding(self): xml = u'?xml version=1.0 encoding=iso-8859-15 ?\nfoobar//foo' -response = self._makeOne(body=xml, headers={'content-type': 'application/foo; charset=utf-8'}) +response = self._makeOne(body=xml, headers={'content-type': 'text/xml; charset=utf-8'}) self.assertEqual(xml.replace('iso-8859-15', 'utf-8')==response.body, True) -response = self._makeOne(body=xml, headers={'content-type': 'application/foo; charset=iso-8859-15'}) +response = self._makeOne(body=xml, headers={'content-type': 'text/xml; charset=iso-8859-15'}) self.assertEqual(xml==response.body, True) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/ - Collector #2208: rewriting/setting the 'charset' part of the content-type
Log message for revision 70565: - Collector #2208: rewriting/setting the 'charset' part of the content-type HTTP header will be done only for 'text/*' Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py U Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-10-08 08:30:16 UTC (rev 70564) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-10-08 08:41:15 UTC (rev 70565) @@ -11,7 +11,10 @@ - Collector #2205: fixed wrong logger argument in ZRDB/Connection.py + - Collector #2208: rewriting/setting the 'charset' part of the content-type +HTTP header will be done only for 'text/*' + Zope 2.9.5 (2006/10/03) Bugs fixed Modified: Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py === --- Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py 2006-10-08 08:30:16 UTC (rev 70564) +++ Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py 2006-10-08 08:41:15 UTC (rev 70565) @@ -343,7 +343,7 @@ self.setHeader('content-type', c) else: c = self.headers['content-type'] -if not 'charset=' in c: +if c.startswith('text/') and not 'charset=' in c: c = '%s; charset=%s' % (c, default_encoding) self.setHeader('content-type', c) Modified: Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py === --- Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-10-08 08:30:16 UTC (rev 70564) +++ Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-10-08 08:41:15 UTC (rev 70565) @@ -94,11 +94,17 @@ self.assertEqual(response.headers.get('content-type'), 'text/plain; charset=iso-8859-15') -def test_charset_application_header(self): +def test_charset_application_header_no_header(self): response = self._makeOne(body='foo', headers={'content-type': 'application/foo'}) self.assertEqual(response.headers.get('content-type'), - 'application/foo; charset=iso-8859-15') + 'application/foo') + +def test_charset_application_header_with_header(self): +response = self._makeOne(body='foo', +headers={'content-type': 'application/foo; charset: something'}) +self.assertEqual(response.headers.get('content-type'), + 'application/foo; charset: something') def test_charset_application_header_unicode(self): response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), @@ -115,6 +121,7 @@ self.assertEqual(response.body, unicode('ärger', 'iso-8859-15').encode('utf-8')) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test')) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2209: ZTUtils module could not be used inside ZPT
Log message for revision 70569: - Collector #2209: ZTUtils module could not be used inside ZPT Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/Products/PageTemplates/__init__.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-10-08 10:38:47 UTC (rev 70568) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-10-08 10:54:03 UTC (rev 70569) @@ -11,7 +11,9 @@ - Collector #2208: rewriting/setting the 'charset' part of the content-type HTTP header will be done only for 'text/*' + - Collector #2209: ZTUtils module could not be used inside ZPT + Zope 2.10.0 (2006/10/04) Bugs fixed Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/__init__.py === --- Zope/branches/2.10/lib/python/Products/PageTemplates/__init__.py 2006-10-08 10:38:47 UTC (rev 70568) +++ Zope/branches/2.10/lib/python/Products/PageTemplates/__init__.py 2006-10-08 10:54:03 UTC (rev 70569) @@ -21,6 +21,11 @@ # Placeholder for Zope Product data misc_ = {} +# import ZTUtils in order to make i importable through +# ZopeGuards.load_module() where an importable modules must be +# available in sys.modules +import ZTUtils + def initialize(context): # Import lazily, and defer initialization to the module import ZopePageTemplate ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins