[Zope-Checkins] SVN: Zope/trunk/ Changed the value for `default-zpublisher-encoding` and `management_page_charset` to `utf-8`.
Hanno Schlichting
hannosch at hannosch.eu
Sat Jul 2 13:07:05 EDT 2011
Log message for revision 122063:
Changed the value for `default-zpublisher-encoding` and `management_page_charset` to `utf-8`.
Changed:
U Zope/trunk/doc/CHANGES.rst
U Zope/trunk/src/OFS/PropertySheets.py
U Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py
U Zope/trunk/src/Products/PageTemplates/tests/testExpressions.py
U Zope/trunk/src/Products/PageTemplates/tests/testZopePageTemplate.py
U Zope/trunk/src/Products/PageTemplates/unicodeconflictresolver.py
D Zope/trunk/src/Products/ZReST/TODO.txt
U Zope/trunk/src/Products/ZReST/ZReST.py
U Zope/trunk/src/Products/ZReST/tests/test_ZReST.py
U Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
U Zope/trunk/src/ZPublisher/Converters.py
U Zope/trunk/src/ZPublisher/HTTPRequest.py
U Zope/trunk/src/ZPublisher/HTTPResponse.py
U Zope/trunk/src/ZPublisher/tests/exception_handling.txt
U Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
U Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py
U Zope/trunk/src/ZPublisher/tests/test_Converters.py
U Zope/trunk/src/Zope2/Startup/__init__.py
U Zope/trunk/src/Zope2/Startup/tests/test_schema.py
U Zope/trunk/src/Zope2/Startup/zopeschema.xml
U Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in
U Zope/trunk/src/reStructuredText/tests/testReST.py
U Zope/trunk/src/webdav/litmus-results.txt
U Zope/trunk/src/webdav/xmltools.py
-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/doc/CHANGES.rst 2011-07-02 17:07:04 UTC (rev 122063)
@@ -31,6 +31,9 @@
Restructuring
+++++++++++++
+- Changed the value for `default-zpublisher-encoding` and
+ `management_page_charset` to `utf-8`.
+
- Removed the `enable-ms-author-via` directive which was only required for
very old web folder implementations from before 2007.
Modified: Zope/trunk/src/OFS/PropertySheets.py
===================================================================
--- Zope/trunk/src/OFS/PropertySheets.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/OFS/PropertySheets.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -791,7 +791,6 @@
if not isinstance(value, basestring):
value = unicode(value)
if not isinstance(value, unicode):
- # XXX It really shouldn't be hardcoded to latin-1 here.
- value = value.decode('latin-1')
+ value = value.decode('utf-8')
value = escape(value)
return value.encode('utf-8')
Modified: Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -14,7 +14,6 @@
"""
import os
-import re
from AccessControl.class_init import InitializeClass
from AccessControl.Permissions import change_page_templates
@@ -23,7 +22,6 @@
from AccessControl.Permissions import view_management_screens
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityInfo import ClassSecurityInfo
-from AccessControl.ZopeGuards import safe_builtins
from Acquisition import Acquired
from Acquisition import Explicit
from Acquisition import aq_get
@@ -51,7 +49,6 @@
preferred_encodings = ['utf-8', 'iso-8859-15']
if os.environ.has_key('ZPT_PREFERRED_ENCODING'):
preferred_encodings.insert(0, os.environ['ZPT_PREFERRED_ENCODING'])
-
class Src(Explicit):
@@ -73,7 +70,7 @@
"Zope wrapper for Page Template using TAL, TALES, and METAL"
meta_type = 'Page Template'
- output_encoding = 'iso-8859-15' # provide default for old instances
+ output_encoding = 'utf-8' # provide default for old instances
func_defaults = None
func_code = FuncCode((), 0)
@@ -147,14 +144,14 @@
output_encoding = charset
else:
encoding = None
- output_encoding = 'iso-8859-15'
+ output_encoding = 'utf-8'
else:
if charset:
encoding = charset
output_encoding = charset
else:
- encoding = 'iso-8859-15'
- output_encoding = 'iso-8859-15'
+ encoding = 'utf-8'
+ output_encoding = 'utf-8'
else:
utext, encoding = convertToUnicode(text,
Modified: Zope/trunk/src/Products/PageTemplates/tests/testExpressions.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/tests/testExpressions.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/PageTemplates/tests/testExpressions.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -1,4 +1,4 @@
-# *-* coding: iso-8859-15 -*-
+# *-* coding: iso-8859-1 -*-
import unittest
@@ -26,7 +26,7 @@
def __call__(self):
return 'dummy'
- management_page_charset = 'iso-8859-15'
+ management_page_charset = 'utf-8'
class DummyDocumentTemplate:
__allow_access_to_unprotected_subobjects__ = 1
@@ -184,8 +184,8 @@
import StrictUnicodeEncodingConflictResolver
from Products.PageTemplates.interfaces \
import IUnicodeEncodingConflictResolver
- provideUtility(StrictUnicodeEncodingConflictResolver,
- IUnicodeEncodingConflictResolver)
+ provideUtility(StrictUnicodeEncodingConflictResolver,
+ IUnicodeEncodingConflictResolver)
self.assertEqual(ec.evaluate(expr), u'äüö')
class UntrustedEngineTests(EngineTestsBase, unittest.TestCase):
@@ -229,8 +229,8 @@
provideUtility(StrictUnicodeEncodingConflictResolver,
IUnicodeEncodingConflictResolver)
resolver = getUtility(IUnicodeEncodingConflictResolver)
- self.assertRaises(UnicodeDecodeError,
- resolver.resolve, None, 'äüö', None)
+ text = u'\xe4\xfc\xe4'
+ self.assertEqual(resolver.resolve(None, text, None), text)
def testIgnoringResolver(self):
from zope.component import getUtility
Modified: Zope/trunk/src/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/tests/testZopePageTemplate.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/PageTemplates/tests/testZopePageTemplate.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -13,7 +13,7 @@
import transaction
import zope.component.testing
-from zope.traversing.adapters import DefaultTraversable, Traverser
+from zope.traversing.adapters import DefaultTraversable
from zope.publisher.http import HTTPCharsets
from Testing.makerequest import makerequest
@@ -200,7 +200,7 @@
output_encoding='ascii',
)
state = cPickle.dumps(empty, protocol=1)
- clone = cPickle.loads(state)
+ cPickle.loads(state)
def testBug246983(self):
# See https://bugs.launchpad.net/bugs/246983
@@ -250,7 +250,7 @@
result = zpt.pt_render()
# use startswith() because the renderer appends a trailing \n
self.assertEqual(result.encode('ascii').startswith(ascii_str), True)
- self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+ self.assertEqual(zpt.output_encoding, 'utf-8')
def testPT_RenderUnicodeExpr(self):
# Check workaround for unicode incompatibility of ZRPythonExpr.
@@ -260,7 +260,7 @@
'unicode(\'\xfe\', \'iso-8859-15\')" />'),
encoding='iso-8859-15')
zpt = self.app['test']
- result = zpt.pt_render() # should not raise a UnicodeDecodeError
+ zpt.pt_render() # should not raise a UnicodeDecodeError
def testPT_RenderWithISO885915(self):
manage_addPageTemplate(self.app, 'test',
@@ -270,7 +270,7 @@
# use startswith() because the renderer appends a trailing \n
self.assertTrue(result.encode('iso-8859-15'
).startswith(iso885915_str))
- self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+ self.assertEqual(zpt.output_encoding, 'utf-8')
def testPT_RenderWithUTF8(self):
manage_addPageTemplate(self.app, 'test',
@@ -279,7 +279,7 @@
result = zpt.pt_render()
# use startswith() because the renderer appends a trailing \n
self.assertEqual(result.encode('utf-8').startswith(utf8_str), True)
- self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+ self.assertEqual(zpt.output_encoding, 'utf-8')
def testWriteAcceptsUnicode(self):
manage_addPageTemplate(self.app, 'test', '', encoding='utf-8')
@@ -323,14 +323,9 @@
self.assertEqual(zpt.output_encoding, 'utf-8')
self.assertEqual(zpt.content_type, 'text/html')
- def testPutHTMLIso8859_15WithoutCharsetInfo(self):
- zpt = self._put(html_iso_8859_15_wo_header)
- self.assertEqual(zpt.output_encoding, 'iso-8859-15')
- self.assertEqual(zpt.content_type, 'text/html')
-
def testPutHTMLUTF8_WithoutCharsetInfo(self):
zpt = self._put(html_utf8_wo_header)
- self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+ self.assertEqual(zpt.output_encoding, 'utf-8')
self.assertEqual(zpt.content_type, 'text/html')
def testPutXMLIso8859_15(self):
@@ -338,20 +333,20 @@
zpt = self._put(xml_iso_8859_15)
self.assertEqual(zpt.output_encoding, 'utf-8')
self.assertEqual(zpt.content_type, 'text/xml')
- result = zpt.pt_render() # should not raise an exception
+ zpt.pt_render() # should not raise an exception
def testPutXMLUTF8(self):
""" XML: use always UTF-8 als output encoding """
zpt = self._put(xml_utf8)
self.assertEqual(zpt.output_encoding, 'utf-8')
self.assertEqual(zpt.content_type, 'text/xml')
- result = zpt.pt_render() # should not raise an exception
+ zpt.pt_render() # should not raise an exception
def testXMLAttrsMustNotBeLowercased(self):
zpt = self._put(xml_with_upper_attr)
self.assertEqual(zpt.content_type, 'text/xml')
result = zpt.pt_render()
- self.assertEqual('ATTR' in result, True)
+ self.assertEqual('ATTR' in result, True)
def testHTMLAttrsAreLowerCased(self):
zpt = self._put(html_with_upper_attr)
@@ -372,9 +367,9 @@
# This test checks the edgecase where the unicode conflict resolver
# is called with a context object having no REQUEST
class ContextMock:
- management_page_charset = 'iso-8859-15'
+ management_page_charset = 'utf-8'
result = PreferredCharsetResolver.resolve(ContextMock(), 'üöä', None)
- self.assertEqual(result, u'üöä')
+ self.assertEqual(result, 'üöä')
class ZPTRegressions(unittest.TestCase):
Modified: Zope/trunk/src/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/unicodeconflictresolver.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/PageTemplates/unicodeconflictresolver.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -54,7 +54,11 @@
return unicode(text)
except UnicodeDecodeError:
encoding = getattr(context, 'management_page_charset', default_encoding)
- return unicode(text, encoding, self.mode)
+ try:
+ return unicode(text, encoding, self.mode)
+ except UnicodeDecodeError:
+ # finally try the old management_page_charset default
+ return unicode(text, 'iso-8859-15', self.mode)
class PreferredCharsetResolver:
Deleted: Zope/trunk/src/Products/ZReST/TODO.txt
===================================================================
--- Zope/trunk/src/Products/ZReST/TODO.txt 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/ZReST/TODO.txt 2011-07-02 17:07:04 UTC (rev 122063)
@@ -1,5 +0,0 @@
-. charset configuration, defaulting to 'latin-1'
-. add "level" and "header" args to render / as_html
- - level indicates the header level to start at
- - header boolean turns page header tags on/off
-
Modified: Zope/trunk/src/Products/ZReST/ZReST.py
===================================================================
--- Zope/trunk/src/Products/ZReST/ZReST.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/ZReST/ZReST.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -73,8 +73,8 @@
{'id':'stylesheet', 'type': 'string', 'mode': 'w',
'default': ''},
{'id':'report_level', 'type': 'string', 'mode': 'w', 'default': '2'},
- {'id':'input_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
- {'id':'output_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
+ {'id':'input_encoding', 'type': 'string', 'mode': 'w', 'default': 'utf-8'},
+ {'id':'output_encoding', 'type': 'string', 'mode': 'w', 'default': 'utf-8'},
)
property_extensible_schema__ = 0
Modified: Zope/trunk/src/Products/ZReST/tests/test_ZReST.py
===================================================================
--- Zope/trunk/src/Products/ZReST/tests/test_ZReST.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Products/ZReST/tests/test_ZReST.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
""" Unit tests for ZReST objects
"""
@@ -12,7 +12,7 @@
text text
-Von Vögeln und Öfen
+Von V\xc3\xb6geln und \xc3\x96fen
===================
- some
@@ -62,15 +62,15 @@
def testConversion(self):
resty = self._makeOne()
resty.source = txt
- resty.input_encoding = 'iso-8859-15'
- resty.output_encoding = 'iso-8859-15'
+ resty.input_encoding = 'utf-8'
+ resty.output_encoding = 'utf-8'
resty.render()
html = resty.index_html()
s = '<h1>Hello World</h1>'
self.assertEqual(s in html, True)
- s = '<h1>Von Vögeln und Öfen</h1>'
+ s = '<h1>Von V\xc3\xb6geln und \xc3\x96fen</h1>'
self.assertEqual(s in html, True)
# ZReST should render a complete HTML document
Modified: Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt 2011-07-02 17:07:04 UTC (rev 122063)
@@ -86,7 +86,7 @@
... """)
HTTP/1.1 200 OK
Content-Length: 5
- Content-Type: text/plain; charset=iso-8859-15
+ Content-Type: text/plain; charset=utf-8
<BLANKLINE>
index
Modified: Zope/trunk/src/ZPublisher/Converters.py
===================================================================
--- Zope/trunk/src/ZPublisher/Converters.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/Converters.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -18,7 +18,7 @@
from cgi import escape
# This may get overwritten during configuration
-default_encoding = 'iso-8859-15'
+default_encoding = 'utf-8'
def field2string(v):
if hasattr(v,'read'): return v.read()
Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/HTTPRequest.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/HTTPRequest.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -56,7 +56,7 @@
base64 = None
# This may get overwritten during configuration
-default_encoding = 'iso-8859-15'
+default_encoding = 'utf-8'
isCGI_NAMEs = {
'SERVER_SOFTWARE' : 1,
@@ -642,7 +642,7 @@
# We have a string with a specified character
# encoding. This gets passed to the converter
# either as unicode, if it can handle it, or
- # crunched back down to latin-1 if it can not.
+ # crunched back down to utf-8 if it can not.
item = unicode(item,character_encoding)
if hasattr(converter,'convert_unicode'):
item = converter.convert_unicode(item)
Modified: Zope/trunk/src/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/trunk/src/ZPublisher/HTTPResponse.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/HTTPResponse.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -36,7 +36,7 @@
nl2sp = maketrans('\n', ' ')
# This may get overwritten during configuration
-default_encoding = 'iso-8859-15'
+default_encoding = 'utf-8'
# Enable APPEND_TRACEBACKS to make Zope append tracebacks like it used to,
# but a better solution is to make standard_error_message display error_tb.
Modified: Zope/trunk/src/ZPublisher/tests/exception_handling.txt
===================================================================
--- Zope/trunk/src/ZPublisher/tests/exception_handling.txt 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/tests/exception_handling.txt 2011-07-02 17:07:04 UTC (rev 122063)
@@ -158,7 +158,7 @@
HTTPError: HTTP Error 401: Unauthorized
>>> 'Error Type: Unauthorized' in browser.contents
True
- >>> 'Error Value: ERROR VALUE ?' in browser.contents
+ >>> 'Error Value: ERROR VALUE \xce\xa9' in browser.contents
True
>>> browser.headers['WWW-Authenticate']
'basic realm="Zope2"'
Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -205,7 +205,6 @@
('utext:utext:utf8', 'test\xc2\xae\ntest\xc2\xae\n'),
('utokens:utokens:utf8', 'test\xc2\xae test\xc2\xae'),
('ulines:ulines:utf8', 'test\xc2\xae\ntest\xc2\xae'),
-
('nouconverter:string:utf8', 'test\xc2\xae'))
req = self._processInputs(inputs)
@@ -219,8 +218,8 @@
self.assertEquals(req['utokens'], [u'test\u00AE', u'test\u00AE'])
self.assertEquals(req['ulines'], [u'test\u00AE', u'test\u00AE'])
- # expect a latin1 encoded version
- self.assertEquals(req['nouconverter'], 'test\xae')
+ # expect a utf-8 encoded version
+ self.assertEquals(req['nouconverter'], 'test\xc2\xae')
self._noTaintedValues(req)
self._onlyTaintedformHoldsTaintedStrings(req)
Modified: Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPResponse.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
import unittest
import sys
@@ -68,13 +68,13 @@
def test_ctor_charset_no_content_type_header(self):
response = self._makeOne(body='foo')
self.assertEqual(response.headers.get('content-type'),
- 'text/plain; charset=iso-8859-15')
+ 'text/plain; charset=utf-8')
def test_ctor_charset_text_header_no_charset_defaults_latin1(self):
response = self._makeOne(body='foo',
headers={'content-type': 'text/plain'})
self.assertEqual(response.headers.get('content-type'),
- 'text/plain; charset=iso-8859-15')
+ 'text/plain; charset=utf-8')
def test_ctor_charset_application_header_no_header(self):
response = self._makeOne(body='foo',
@@ -90,15 +90,15 @@
'application/foo; charset: something')
def test_ctor_charset_unicode_body_application_header(self):
- BODY = unicode('ärger', 'iso-8859-15')
+ BODY = u'\xe4rger'
response = self._makeOne(body=BODY,
headers={'content-type': 'application/foo'})
self.assertEqual(response.headers.get('content-type'),
- 'application/foo; charset=iso-8859-15')
- self.assertEqual(response.body, 'ärger')
+ 'application/foo; charset=utf-8')
+ self.assertEqual(response.body, BODY.encode('utf-8'))
def test_ctor_charset_unicode_body_application_header_diff_encoding(self):
- BODY = unicode('ärger', 'iso-8859-15')
+ BODY = u'\xe4rger'
response = self._makeOne(body=BODY,
headers={'content-type':
'application/foo; charset=utf-8'})
@@ -562,7 +562,7 @@
self.assertTrue(result)
self.assertEqual(response.body, EXPECTED)
self.assertEqual(response.getHeader('Content-Type'),
- 'text/html; charset=iso-8859-15')
+ 'text/html; charset=utf-8')
self.assertEqual(response.getHeader('Content-Length'),
str(len(EXPECTED)))
@@ -576,7 +576,7 @@
self.assertTrue('TITLE' in response.body)
self.assertTrue('BODY' in response.body)
self.assertEqual(response.getHeader('Content-Type'),
- 'text/html; charset=iso-8859-15')
+ 'text/html; charset=utf-8')
def test_setBody_string_not_HTML(self):
response = self._makeOne()
@@ -584,7 +584,7 @@
self.assertTrue(result)
self.assertEqual(response.body, 'BODY')
self.assertEqual(response.getHeader('Content-Type'),
- 'text/plain; charset=iso-8859-15')
+ 'text/plain; charset=utf-8')
self.assertEqual(response.getHeader('Content-Length'), '4')
def test_setBody_string_HTML(self):
@@ -594,7 +594,7 @@
self.assertTrue(result)
self.assertEqual(response.body, HTML)
self.assertEqual(response.getHeader('Content-Type'),
- 'text/html; charset=iso-8859-15')
+ 'text/html; charset=utf-8')
self.assertEqual(response.getHeader('Content-Length'), str(len(HTML)))
def test_setBody_object_with_asHTML(self):
@@ -607,18 +607,18 @@
self.assertTrue(result)
self.assertEqual(response.body, HTML)
self.assertEqual(response.getHeader('Content-Type'),
- 'text/html; charset=iso-8859-15')
+ 'text/html; charset=utf-8')
self.assertEqual(response.getHeader('Content-Length'), str(len(HTML)))
def test_setBody_object_with_unicode(self):
HTML = u'<html><head></head><body><h1>Tr\u0039s Bien</h1></body></html>'
- ENCODED = HTML.encode('iso-8859-15')
+ ENCODED = HTML.encode('utf-8')
response = self._makeOne()
result = response.setBody(HTML)
self.assertTrue(result)
self.assertEqual(response.body, ENCODED)
self.assertEqual(response.getHeader('Content-Type'),
- 'text/html; charset=iso-8859-15')
+ 'text/html; charset=utf-8')
self.assertEqual(response.getHeader('Content-Length'),
str(len(ENCODED)))
@@ -737,7 +737,7 @@
def test_redirect_explicit_status(self):
URL = 'http://example.com'
response = self._makeOne()
- result = response.redirect(URL, status=307)
+ response.redirect(URL, status=307)
self.assertEqual(response.status, 307)
self.assertEqual(response.getHeader('Location'), URL)
self.assertFalse(response._locked_status)
@@ -745,7 +745,7 @@
def test_redirect_w_lock(self):
URL = 'http://example.com'
response = self._makeOne()
- result = response.redirect(URL, lock=True)
+ response.redirect(URL, lock=True)
self.assertEqual(response.status, 302)
self.assertEqual(response.getHeader('Location'), URL)
self.assertTrue(response._locked_status)
@@ -1100,7 +1100,7 @@
[('X-Powered-By', 'Zope (www.zope.org), '
'Python (www.python.org)'),
('Content-Length', '4'),
- ('Content-Type', 'text/plain; charset=iso-8859-15'),
+ ('Content-Type', 'text/plain; charset=utf-8'),
])
def test___str__already_wrote(self):
@@ -1251,7 +1251,7 @@
'Python (www.python.org)')
self.assertEqual(lines[2], 'Content-Length: 4')
self.assertEqual(lines[3],
- 'Content-Type: text/plain; charset=iso-8859-15')
+ 'Content-Type: text/plain; charset=utf-8')
self.assertEqual(lines[4], '')
self.assertEqual(lines[5], 'BLAH')
Modified: Zope/trunk/src/ZPublisher/tests/test_Converters.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/test_Converters.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/ZPublisher/tests/test_Converters.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -24,7 +24,7 @@
from ZPublisher.Converters import field2string
to_convert = u'to_convert'
self.assertEqual(field2string(to_convert),
- to_convert.encode('iso-8859-15'))
+ to_convert.encode('utf-8'))
def test_field2string_with_filelike_object(self):
from ZPublisher.Converters import field2string
Modified: Zope/trunk/src/Zope2/Startup/__init__.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/__init__.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Zope2/Startup/__init__.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -152,7 +152,7 @@
# workaround to allow unicode encoding conversions in DTML
import codecs
- dummy = codecs.lookup('iso-8859-1')
+ dummy = codecs.lookup('utf-8')
locale_id = self.cfg.locale
Modified: Zope/trunk/src/Zope2/Startup/tests/test_schema.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/tests/test_schema.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Zope2/Startup/tests/test_schema.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -202,13 +202,13 @@
conf, dummy = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
""")
- self.assertEqual(conf.default_zpublisher_encoding, 'iso-8859-15')
+ self.assertEqual(conf.default_zpublisher_encoding, 'utf-8')
conf, dummy = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
- default-zpublisher-encoding utf-8
+ default-zpublisher-encoding iso-8859-15
""")
- self.assertEqual(conf.default_zpublisher_encoding, 'utf-8')
+ self.assertEqual(conf.default_zpublisher_encoding, 'iso-8859-15')
def test_suite():
Modified: Zope/trunk/src/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/trunk/src/Zope2/Startup/zopeschema.xml 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Zope2/Startup/zopeschema.xml 2011-07-02 17:07:04 UTC (rev 122063)
@@ -841,7 +841,7 @@
<key name="default-zpublisher-encoding"
datatype=".default_zpublisher_encoding"
- default="iso-8859-15">
+ default="utf-8">
<description>
This key controls what character set is used to encode unicode
data that reaches ZPublisher without any other specified encoding.
Modified: Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in
===================================================================
--- Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in 2011-07-02 17:07:04 UTC (rev 122063)
@@ -355,104 +355,6 @@
# verbose-security on
-# Directive: maximum-number-of-session-objects
-#
-# Description:
-# An integer value representing the number of items to use as a
-# "maximum number of subobjects" value of the
-# '/temp_folder/session_data' transient object container.
-#
-# Default: 1000
-#
-# Example:
-#
-# maximum-number-of-session-objects 10000
-
-
-# Directive: session-add-notify-script-path
-#
-# Description:
-# An optional fill Zope path name of a callable object to be set as the
-# "script to call on object addition" of the sessioN_data transient
-# object container created in the /temp_folder folder at startup.
-#
-# Default: unset
-#
-# Example:
-#
-# session-add-notify-script-path /scripts/add_notifier
-
-
-# Directive: session-delete-notify-script-path
-#
-# Description:
-# An optional fill Zope path name of a callable object to be set as the
-# "script to call on object deletion" of the sessioN_data transient
-# object container created in the /temp_folder folder at startup.
-#
-# Default: unset
-#
-# Example:
-#
-# session-delete-notify-script-path /scripts/del_notifier
-
-
-# Directive: session-timeout-minutes
-#
-# Description:
-# An integer value representing the number of minutes to be used as the
-# "data object timeout" of the '/temp_folder/session_data' transient
-# object container.
-#
-# Default: 20
-#
-# Example:
-#
-# session-timeout-minutes 30
-
-
-# Directive: session-resolution-seconds
-#
-# Description:
-# An integer value representing the number of seconds to be used as the
-# "timeout resolution" of the '/temp_folder/session_data' transient
-# object container.
-#
-# Default: 20
-#
-# Example:
-#
-# session-resolution-seconds 60
-
-
-# Directive: suppress-all-access-rules
-#
-# Description:
-# If this directive is set to on, no access rules in your Zope site
-# will be executed. This is useful if you "lock yourself out" of a
-# particular part of your site by setting an improper access rule.
-#
-# Default: off
-#
-# Example:
-#
-# suppress-all-access-rules on
-
-
-# Directive: suppress-all-site-roots
-#
-# Description:
-# If this directive is set to on, no site roots in your Zope site will
-# be effective. This is useful if you "lock yourself out" of a
-# particular part of your site by setting an improper site root.
-#
-# Default: off
-#
-# Example:
-#
-# suppress-all-site-roots on
-
-
# Directives: logger
#
# Description:
@@ -627,17 +529,6 @@
#
# large-file-threshold 1Mb
-# Directive: default-zpublisher-encoding
-#
-# Description:
-# This controls what character set is used to encode unicode
-# data that reaches ZPublisher without any other specified encoding.
-#
-# Default: iso-8859-15
-#
-# Example:
-#
-# default-zpublisher-encoding utf-8
# Directives: servers
#
Modified: Zope/trunk/src/reStructuredText/tests/testReST.py
===================================================================
--- Zope/trunk/src/reStructuredText/tests/testReST.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/reStructuredText/tests/testReST.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
import unittest
import cgi
@@ -11,7 +11,7 @@
text text
-Von Vögeln und Öfen
+Von V\xc3\xb6geln und \xc3\x96fen
===================
- some
@@ -43,26 +43,25 @@
input_encoding=in_enc,
output_encoding=out_enc)
- encoding = 'iso-8859-15'
+ encoding = 'utf-8'
html = _test(txt, encoding, encoding)
- self.assertEqual('Vögel' in html, True)
- self.assertEqual('Öfen' in html, True)
+ self.assertEqual('V\xc3\xb6gel' in html, True)
+ self.assertEqual('\xc3\x96fen' in html, True)
html = _test(txt, encoding, 'unicode')
- self.assertEqual(unicode('Vögel', encoding) in html, True)
- self.assertEqual(unicode('Öfen', encoding) in html, True)
+ self.assertEqual(unicode('V\xc3\xb6gel', encoding) in html, True)
+ self.assertEqual(unicode('\xc3\x96fen', encoding) in html, True)
html = _test(unicode(txt, encoding), 'unicode', encoding)
- self.assertEqual('Vögel' in html, True)
- self.assertEqual('Öfen' in html, True)
+ self.assertEqual('V\xc3\xb6gel' in html, True)
+ self.assertEqual('\xc3\x96fen' in html, True)
html = _test(unicode(txt, encoding), 'unicode', 'unicode')
- self.assertEqual(unicode('Vögel', encoding) in html, True)
- self.assertEqual(unicode('Öfen', encoding) in html, True)
+ self.assertEqual(unicode('V\xc3\xb6gel', encoding) in html, True)
+ self.assertEqual(unicode('\xc3\x96fen', encoding) in html, True)
def testHeaderLevel(self):
-
- encoding = 'iso-8859-15'
+ encoding = 'utf-8'
for level in range(0, 5):
html = HTML(txt, input_encoding=encoding,
output_encoding=encoding,
@@ -71,7 +70,8 @@
expected = '<h%d>Hello World</h%d>' % (level+1, level+1)
self.assertEqual(expected in html, True)
- expected = '<h%d>Von Vögeln und Öfen</h%d>' % (level+1, level+1)
+ expected = '<h%d>Von V\xc3\xb6geln und \xc3\x96fen</h%d>' % (
+ level+1, level+1)
self.assertEqual(expected in html, True)
def testWithSingleSubtitle(self):
Modified: Zope/trunk/src/webdav/litmus-results.txt
===================================================================
--- Zope/trunk/src/webdav/litmus-results.txt 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/webdav/litmus-results.txt 2011-07-02 17:07:04 UTC (rev 122063)
@@ -158,7 +158,7 @@
Zope responds to this with a success response like this:
- <?xml version="1.0" encoding="iso-8859-15" ?>
+ <?xml version="1.0" encoding="utf-8" ?>
<d:prop xmlns:d="DAV:">
<d:lockdiscovery>
<d:activelock>
Modified: Zope/trunk/src/webdav/xmltools.py
===================================================================
--- Zope/trunk/src/webdav/xmltools.py 2011-07-02 16:22:43 UTC (rev 122062)
+++ Zope/trunk/src/webdav/xmltools.py 2011-07-02 17:07:04 UTC (rev 122063)
@@ -26,7 +26,7 @@
NOTE: So far i didn't have any problems.
If you have problems please report them.
- - We are using a hardcoded default of latin-1 for encoding unicode
+ - We are using a hardcoded default of utf-8 for encoding unicode
strings. While this is suboptimal, it does match the expected
encoding from OFS.PropertySheet. We need to find a the encoding
somehow, maybe use the same encoding as the ZMI is using?
@@ -59,11 +59,11 @@
_ent.update(entities)
return _unescape(value, entities)
-# XXX latin-1 is hardcoded on OFS.PropertySheets as the expected
+# utf-8 is hardcoded on OFS.PropertySheets as the expected
# encoding properties will be stored in. Optimally, we should use the
# same encoding as the 'default_encoding' property that is used for
# the ZMI.
-zope_encoding = 'latin-1'
+zope_encoding = 'utf-8'
class Node:
""" Our nodes no matter what type
More information about the Zope-Checkins
mailing list