[Zope3-checkins] CVS: Zope3/src/zope/i18n/tests - test_itranslationservice.py:1.9 test_translator.py:1.10

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 2 12:49:41 EST 2004


Update of /cvs-repository/Zope3/src/zope/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv28374/src/zope/i18n/tests

Modified Files:
	test_itranslationservice.py test_translator.py 
Log Message:


Completed making the language negotiator a utility.



For tests, register a new utility, not a service.


=== Zope3/src/zope/i18n/tests/test_itranslationservice.py 1.8 => 1.9 ===
--- Zope3/src/zope/i18n/tests/test_itranslationservice.py:1.8	Sat Jan 10 06:02:37 2004
+++ Zope3/src/zope/i18n/tests/test_itranslationservice.py	Tue Mar  2 12:49:40 2004
@@ -15,13 +15,12 @@
 
 $Id$
 """
-
 import unittest
 from zope.interface.verify import verifyObject
+from zope.component import getService
+from zope.component.servicenames import Utilities
 from zope.component.tests.placelesssetup import PlacelessSetup
 
-# XXX Bad, can't depend on app!
-from zope.app.component.metaconfigure import provideService, managerHandler
 from zope.i18n.negotiator import negotiator
 from zope.i18n.interfaces import INegotiator
 from zope.i18n.interfaces import IUserPreferredLanguages
@@ -51,9 +50,9 @@
         super(TestITranslationService, self).setUp()
         self._service = self._getTranslationService()
         assert verifyObject(ITranslationService, self._service)
-        # Setup the negotiator service registry entry
-        managerHandler('defineService', 'LanguageNegotiation', INegotiator)
-        provideService('LanguageNegotiation', negotiator, 'zope.Public')
+        # Setup the negotiator utility
+        utilities = getService(None, Utilities)
+        utilities.provideUtility(INegotiator, negotiator)
 
     # I know, I know. This is not part of the interface, but it is implemented
     # in every Translation Service, so it fits well here.


=== Zope3/src/zope/i18n/tests/test_translator.py 1.9 => 1.10 ===
--- Zope3/src/zope/i18n/tests/test_translator.py:1.9	Fri Feb 27 17:25:23 2004
+++ Zope3/src/zope/i18n/tests/test_translator.py	Tue Mar  2 12:49:40 2004
@@ -18,8 +18,9 @@
 import os
 import unittest
 
+from zope.component import getServiceManager, getService
+from zope.component.servicenames import Utilities
 from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component import getServiceManager
 
 from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
 from zope.i18n.interfaces import ITranslationService, INegotiator
@@ -39,8 +40,10 @@
         sm.defineService('Translation', ITranslationService)
         sm.provideService('Translation', SimpleTranslationService(data))
 
-        sm.defineService('LanguageNegotiation', INegotiator)
-        sm.provideService('LanguageNegotiation', negotiator)
+        # Setup the negotiator utility
+        utilities = getService(None, Utilities)
+        utilities.provideUtility(INegotiator, negotiator)
+
 
     def test_translator(self):
         translator = Translator('default', ContextStub(['de']))
@@ -60,6 +63,5 @@
     return unittest.TestSuite((
         unittest.makeSuite(TranslatorTest),
                            ))
-
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')




More information about the Zope3-Checkins mailing list