[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_browserwidget.py:1.21 test_radiowidget.py:1.12

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:34:28 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv4394/src/zope/app/browser/form/tests

Modified Files:
	test_browserwidget.py test_radiowidget.py 
Log Message:


Use new translation API.




=== Zope3/src/zope/app/browser/form/tests/test_browserwidget.py 1.20 => 1.21 ===
--- Zope3/src/zope/app/browser/form/tests/test_browserwidget.py:1.20	Fri Mar  5 23:17:18 2004
+++ Zope3/src/zope/app/browser/form/tests/test_browserwidget.py	Mon Mar  8 18:33:57 2004
@@ -15,19 +15,21 @@
 
 $Id$
 """
-
+import os
+import unittest
+from zope.testing.doctestunit import DocTestSuite
 from zope.interface import Interface, implements
+
+from zope.app.tests import ztapi
 from zope.app.browser.form.widget import BrowserWidget
 from zope.app.interfaces.form import ConversionError
 from zope.app.interfaces.form import WidgetInputError, MissingInputError
 from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.i18n.interfaces import ITranslationDomain
 from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
-from zope.i18n.globaltranslationservice import translationService
+from zope.i18n.translationdomain import TranslationDomain
 from zope.publisher.browser import TestRequest
 from zope.schema import Text
-import os
-import unittest
-from zope.testing.doctestunit import DocTestSuite
 from zope.app.browser.form.tests import support
 import zope.app.browser.form.tests
 
@@ -104,10 +106,10 @@
     def testTranslatedLabel(self):
         path = os.path.dirname(zope.app.browser.form.tests.__file__)
         catalog = GettextMessageCatalog(
-            'pl', 'zope',
-            os.path.join(path, 'testlabeltranslation.mo'))
-        translationService.addCatalog(catalog)
-
+            'pl', 'zope', os.path.join(path, 'testlabeltranslation.mo'))
+        domain = TranslationDomain('zope')
+        domain.addCatalog(catalog)
+        ztapi.provideUtility(ITranslationDomain, domain, 'zope')
         label = ' '.join(self._widget.label().strip().split())
         self.assertEqual(label, '<label for="field.foo">oofay itletay</label>')
 


=== Zope3/src/zope/app/browser/form/tests/test_radiowidget.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/browser/form/tests/test_radiowidget.py:1.11	Fri Mar  5 23:17:19 2004
+++ Zope3/src/zope/app/browser/form/tests/test_radiowidget.py	Mon Mar  8 18:33:57 2004
@@ -14,12 +14,19 @@
 """
 $Id$
 """
+import os
 import unittest, doctest
+from zope.interface.verify import verifyClass
+
+from zope.i18n.interfaces import ITranslationDomain
+from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
+from zope.i18n.translationdomain import TranslationDomain
 
+from zope.app.tests import ztapi
 from zope.app.interfaces.form import IInputWidget
 from zope.app.browser.form.widget import RadioWidget
 from zope.app.browser.form.tests.test_browserwidget import BrowserWidgetTest
-from zope.interface.verify import verifyClass
+import zope.app.browser.form.tests
 
 class RadioWidgetTest(BrowserWidgetTest):
     """Documents and tests the radio widget.
@@ -82,16 +89,12 @@
         self.assertEqual(label, 'Foo Title')
 
     def testTranslatedLabel(self):
-        import zope.app.browser.form.tests
-        from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
-        from zope.i18n.globaltranslationservice import translationService
-        import os
         path = os.path.dirname(zope.app.browser.form.tests.__file__)
         catalog = GettextMessageCatalog(
-            'pl', 'zope',
-            os.path.join(path, 'testlabeltranslation.mo'))
-        translationService.addCatalog(catalog)
-
+            'pl', 'zope', os.path.join(path, 'testlabeltranslation.mo'))
+        domain = TranslationDomain('zope')
+        domain.addCatalog(catalog)
+        ztapi.provideUtility(ITranslationDomain, domain, 'zope')
         label = ' '.join(self._widget.label().strip().split())
         self.assertEqual(label, 'oofay itletay')
 




More information about the Zope3-Checkins mailing list