[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/ Make the default TALES context aware of other forms of text (e.g. i18n Messages).

Philipp von Weitershausen philikon at philikon.de
Sat May 20 09:03:53 EDT 2006


Log message for revision 68193:
  Make the default TALES context aware of other forms of text (e.g. i18n Messages).
  This gets rid of some code duplication in zope.app's TALES context.
  

Changed:
  U   Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py
  U   Zope3/branches/3.3/src/zope/tales/tales.py

-=-
Modified: Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py	2006-05-20 12:56:58 UTC (rev 68192)
+++ Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py	2006-05-20 13:03:52 UTC (rev 68193)
@@ -96,15 +96,6 @@
 class ZopeContextBase(Context):
     """Base class for both trusted and untrusted evaluation contexts."""
 
-    def evaluateText(self, expr):
-        text = self.evaluate(expr)
-        if text is self.getDefault() or text is None:
-            return text
-        if isinstance(text, basestring):
-            # text could be a proxied/wrapped object
-            return text
-        return unicode(text)
-
     def evaluateMacro(self, expr):
         macro = Context.evaluateMacro(self, expr)
         return macro

Modified: Zope3/branches/3.3/src/zope/tales/tales.py
===================================================================
--- Zope3/branches/3.3/src/zope/tales/tales.py	2006-05-20 12:56:58 UTC (rev 68192)
+++ Zope3/branches/3.3/src/zope/tales/tales.py	2006-05-20 13:03:52 UTC (rev 68193)
@@ -704,6 +704,9 @@
         text = self.evaluate(expr)
         if text is self.getDefault() or text is None:
             return text
+        if isinstance(text, basestring):
+            # text could already be something text-ish, e.g. a Message object
+            return text
         return unicode(text)
 
     def evaluateStructure(self, expr):



More information about the Zope3-Checkins mailing list