[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py cleanup

Andreas Jung andreas at andreas-jung.com
Mon Jan 8 14:34:49 EST 2007


Log message for revision 71827:
  cleanup
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py

-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py	2007-01-08 19:30:29 UTC (rev 71826)
+++ Zope/trunk/lib/python/Products/PageTemplates/unicodeconflictresolver.py	2007-01-08 19:34:49 UTC (rev 71827)
@@ -54,8 +54,8 @@
             return unicode(text, encoding, self.mode)
 
 class PreferredCharsetResolver:
-    """ A resolver that tries uses the HTTP_ACCEPT_CHARSET
-        header.
+    """ A resolver that tries use the encoding information
+        from the HTTP_ACCEPT_CHARSET header.
     """
 
     implements(IUnicodeEncodingConflictResolver)
@@ -64,7 +64,8 @@
 
         request = context.REQUEST
 
-        if not hasattr(request, '__zpt_available_charsets'):
+        charsets = getattr(request, '__zpt_available_charsets', None)
+        if charsets is None:
             charsets = IUserPreferredCharsets(request).getPreferredCharsets()
 
             # add management_page_charset as one fallback
@@ -78,9 +79,6 @@
             # cache list of charsets
             request.__zpt_available_charsets = charsets
 
-        else:
-            charsets = request.__zpt_available_charsets
-
         for enc in charsets:
             try:
                 return unicode(text, enc)



More information about the Zope-Checkins mailing list