Commit c3653237 authored by 's avatar

- replaced getattr by aq_get

- whitespace cleanup
parent 1f35ed1d
......@@ -35,6 +35,9 @@ Restructuring
Bugs Fixed
++++++++++
- PageTemplates: Made PreferredCharsetResolver work with new kinds of contexts
that are not acquisition wrapped.
- Object managers should evaluate to True in a boolean test.
2.12.0a1 (2009-02-26)
......
......@@ -10,16 +10,21 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Unicode conflict resolution.
$Id$
"""
import sys
from Acquisition import aq_get
from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
from zope.interface import implements
from zope.i18n.interfaces import IUserPreferredCharsets
from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
default_encoding = sys.getdefaultencoding()
class DefaultUnicodeEncodingConflictResolver:
""" This resolver implements the old-style behavior and will
raise an exception in case of the string 'text' can't be converted
......@@ -53,6 +58,7 @@ class Z2UnicodeEncodingConflictResolver:
encoding = getattr(context, 'management_page_charset', default_encoding)
return unicode(text, encoding, self.mode)
class PreferredCharsetResolver:
""" A resolver that tries use the encoding information
from the HTTP_ACCEPT_CHARSET header.
......@@ -62,7 +68,7 @@ class PreferredCharsetResolver:
def resolve(self, context, text, expression):
request = getattr(context, 'REQUEST', None)
request = aq_get(context, 'REQUEST', None)
# Deal with the fact that a REQUEST is not always available.
# In this case fall back to the encoding of the ZMI and the
......
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