[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py merge from HEAD

Andreas Jung andreas at andreas-jung.com
Sun Jan 7 07:31:44 EST 2007


Log message for revision 71764:
  merge from HEAD
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py

-=-
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py	2007-01-07 12:29:16 UTC (rev 71763)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py	2007-01-07 12:31:44 UTC (rev 71764)
@@ -21,6 +21,7 @@
 import logging
 
 from zope.component import getUtility
+from zope.component.interfaces import ComponentLookupError
 from zope.interface import implements
 from zope.tales.tales import Context, Iterator
 from zope.tales.expressions import PathExpr, StringExpr, NotExpr
@@ -199,9 +200,17 @@
 
         elif isinstance(text, str):
             # bahh...non-unicode string..we need to convert it to unicode
-            resolver = getUtility(IUnicodeEncodingConflictResolver)
 
+            # catch ComponentLookupError in order to make tests shut-up.
+            # This should not be a problem since it won't change the old
+            # default behavior
+
             try:
+                resolver = getUtility(IUnicodeEncodingConflictResolver)
+            except ComponentLookupError:    
+                return unicode(text)
+
+            try:
                 return resolver.resolve(self.contexts['context'], text, expr)
             except UnicodeDecodeError,e:
                 LOG.error("""UnicodeDecodeError detected for expression "%s"\n"""



More information about the Zope-Checkins mailing list