Log message for revision 39843:
  Get rid of a deprecation warning by using the new immutable
  i18n Messages. Made DummyEngine work with them.
  

Changed:
  U   Zope/branches/philikon-zope32-integration/lib/python/TAL/DummyEngine.py
  U   
Zope/branches/philikon-zope32-integration/lib/python/TAL/tests/test_talinterpreter.py

-=-
Modified: 
Zope/branches/philikon-zope32-integration/lib/python/TAL/DummyEngine.py
===================================================================
--- Zope/branches/philikon-zope32-integration/lib/python/TAL/DummyEngine.py     
2005-11-02 11:33:01 UTC (rev 39842)
+++ Zope/branches/philikon-zope32-integration/lib/python/TAL/DummyEngine.py     
2005-11-02 11:35:33 UTC (rev 39843)
@@ -22,17 +22,6 @@
 from ITALES import ITALESCompiler, ITALESEngine
 from DocumentTemplate.DT_Util import ustr
 
-IDomain = None
-try:
-    from Zope2.I18n.ITranslationService import ITranslationService
-    from Zope2.I18n.IDomain import IDomain
-except ImportError:
-    pass
-if IDomain is None:
-    # Before 2.7, or not in Zope
-    class ITranslationService: pass
-    class IDomain: pass
-
 class _Default:
     pass
 Default = _Default()
@@ -234,7 +223,6 @@
         return 1
 
 class DummyDomain:
-    __implements__ = IDomain
 
     def translate(self, msgid, mapping=None, context=None,
                   target_language=None, default=None):
@@ -246,8 +234,10 @@
         # things back together.
 
         # simulate an unknown msgid by returning None
+        text = msgid
         if msgid == "don't translate me":
-            text = default
+            if default is not None:
+                text = default
         else:
             text = msgid.upper()
 
@@ -257,7 +247,6 @@
         return cre.sub(repl, text)
 
 class DummyTranslationService:
-    __implements__ = ITranslationService
 
     def translate(self, domain, msgid, mapping=None, context=None,
                   target_language=None, default=None):

Modified: 
Zope/branches/philikon-zope32-integration/lib/python/TAL/tests/test_talinterpreter.py
===================================================================
--- 
Zope/branches/philikon-zope32-integration/lib/python/TAL/tests/test_talinterpreter.py
       2005-11-02 11:33:01 UTC (rev 39842)
+++ 
Zope/branches/philikon-zope32-integration/lib/python/TAL/tests/test_talinterpreter.py
       2005-11-02 11:35:33 UTC (rev 39843)
@@ -28,7 +28,7 @@
 from TAL.DummyEngine import DummyEngine, DummyTranslationService
 from TAL.TALInterpreter import interpolate
 from TAL.tests import utils
-from zope.i18nmessageid import MessageID
+from zope.i18nmessageid import Message
 
 class TestCaseBase(unittest.TestCase):
 
@@ -67,10 +67,10 @@
 
     def setUp(self):
         self.engine = DummyEngine()
-        self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+        self.engine.setLocal('foo', Message('FoOvAlUe', 'default'))
         self.engine.setLocal('bar', 'BaRvAlUe')
         self.engine.setLocal('raw', ' \tRaW\n ')
-        self.engine.setLocal('noxlt', MessageID("don't translate me"))
+        self.engine.setLocal('noxlt', Message("don't translate me"))
 
     def _check(self, program, expected):
         result = StringIO()

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to