[Zope3-checkins] CVS: Zope3/src/zope/tales - tales.py:1.4

Barry Warsaw barry@zope.com
Wed, 16 Apr 2003 15:34:25 -0400


Update of /cvs-repository/Zope3/src/zope/tales
In directory cvs.zope.org:/tmp/cvs-serv16740

Modified Files:
	tales.py 
Log Message:
evaluateText(): Use proxy_compatible_isinstance() to check to see if
the text is a StringTypes.  text could be a proxied MessageID object
but we want it to pass this test.  If it does, we return the
completely unwrapped object so that the talinterpreter can correctly
translate and interpolate it.


=== Zope3/src/zope/tales/tales.py 1.3 => 1.4 ===
--- Zope3/src/zope/tales/tales.py:1.3	Tue Apr 15 17:40:17 2003
+++ Zope3/src/zope/tales/tales.py	Wed Apr 16 15:34:24 2003
@@ -23,6 +23,8 @@
 import sys
 from types import StringTypes
 
+from zope.proxy import proxy_compatible_isinstance as isinstance_ex
+from zope.proxy.context.wrapper import getbaseobject
 from zope.pagetemplate import iterator
 from zope.pagetemplate import safemapping
 
@@ -278,8 +280,9 @@
         text = self.evaluate(expr)
         if text is _default or text is None:
             return text
-        if isinstance(text, StringTypes):
-            return text
+        if isinstance_ex(text, StringTypes):
+            # text could be a proxied/wrapped object
+            return getbaseobject(text)
         return unicode(text)
 
     def evaluateStructure(self, expr):