[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - placefulsetup.py:1.13 test_adapter.py:1.5 test_auth.py:1.9 test_cacheconfiguration.py:1.4 test_cachingservice.py:1.5 test_configurationregistry.py:1.3 test_connectionconfiguration.py:1.4 test_connectionservice.py:1.4 test_eventservice.py:1.16 test_module.py:1.4 test_serviceconfiguration.py:1.6 test_servicemanager.py:1.3 test_view.py:1.7 test_viewpackage.py:1.6

Jim Fulton jim@zope.com
Tue, 18 Mar 2003 16:02:54 -0500


Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv21177/src/zope/app/services/tests

Modified Files:
	placefulsetup.py test_adapter.py test_auth.py 
	test_cacheconfiguration.py test_cachingservice.py 
	test_configurationregistry.py test_connectionconfiguration.py 
	test_connectionservice.py test_eventservice.py test_module.py 
	test_serviceconfiguration.py test_servicemanager.py 
	test_view.py test_viewpackage.py 
Log Message:
Removed "Packages" from the object hierarchy in site managers (service
managers).  We now traverse directly from site managers to individual
site-management folders.

This change is backward compatible because the underlying data
structures haven't changed.


=== Zope3/src/zope/app/services/tests/placefulsetup.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/services/tests/placefulsetup.py:1.12	Mon Mar 10 17:35:06 2003
+++ Zope3/src/zope/app/services/tests/placefulsetup.py	Tue Mar 18 16:02:23 2003
@@ -166,7 +166,7 @@
         if not folder.hasServiceManager():
             folder.setServiceManager(ServiceManager())
         sm = traverse(folder, '++etc++Services')
-        default = traverse(sm, 'Packages/default')
+        default = traverse(sm, 'default')
         service_name = 'anEventService'
         from zope.app.services.event import EventService
         default.setObject(service_name, EventService())
@@ -206,11 +206,11 @@
         defineService(HubIds, IObjectHub)
 
         sm = traverse(root, '++etc++Services')
-        default = traverse(sm, 'Packages/default')
+        default = traverse(sm, 'default')
         default.setObject("myEventService", EventService())
         default.setObject("myObjectHub", self.getObjectHub())
 
-        path = "%s/Packages/default/myEventService" % getPhysicalPathString(sm)
+        path = "%s/default/myEventService" % getPhysicalPathString(sm)
         configuration = ServiceConfiguration(EventPublication, path, self.rootFolder)
         default['configure'].setObject("myEventServiceDir", configuration)
         traverse(default, 'configure/1').status = Active
@@ -221,7 +221,7 @@
                 "mySubscriptionServiceDir", configuration)
         traverse(default, 'configure/2').status = Active
 
-        path = "%s/Packages/default/myObjectHub" % getPhysicalPathString(sm)
+        path = "%s/default/myObjectHub" % getPhysicalPathString(sm)
         configuration = ServiceConfiguration(HubIds, path, self.rootFolder)
         default['configure'].setObject("myHubIdsServiceDir", configuration)
         traverse(default, 'configure/3').status = Active


=== Zope3/src/zope/app/services/tests/test_adapter.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/services/tests/test_adapter.py:1.4	Wed Jan 15 11:24:01 2003
+++ Zope3/src/zope/app/services/tests/test_adapter.py	Tue Mar 18 16:02:23 2003
@@ -115,7 +115,7 @@
 
         sm = traverse(self.rootFolder, '++etc++Services')
 
-        configure = traverse(sm, 'Packages/default/configure')
+        configure = traverse(sm, 'default/configure')
         configuration = Configuration()
         configure.setObject('', configuration)
         configuration = traverse(configure, '1')
@@ -153,7 +153,7 @@
 
         sm = traverse(self.rootFolder, '++etc++Services')
 
-        configure = traverse(sm, 'Packages/default/configure')
+        configure = traverse(sm, 'default/configure')
         configuration = Configuration()
         configuration.adapterName = u"Yatta!"
         configure.setObject('', configuration)
@@ -205,7 +205,7 @@
 
         sm = traverse(self.rootFolder, '++etc++Services')
 
-        configure = traverse(sm, 'Packages/default/configure')
+        configure = traverse(sm, 'default/configure')
         configuration = Configuration()
         configure.setObject('', configuration)
         configuration = traverse(configure, '1')


=== Zope3/src/zope/app/services/tests/test_auth.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/tests/test_auth.py:1.8	Tue Feb 11 21:17:34 2003
+++ Zope3/src/zope/app/services/tests/test_auth.py	Tue Mar 18 16:02:23 2003
@@ -62,7 +62,7 @@
         if not folder.hasServiceManager():
             self.createServiceManager(folder)
 
-        default = traverse(folder, '++etc++Services/Packages/default')
+        default = traverse(folder, '++etc++Services/default')
         key = default.setObject("AuthenticationService", AuthenticationService())
         auth = traverse(default, key)
 


=== Zope3/src/zope/app/services/tests/test_cacheconfiguration.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_cacheconfiguration.py:1.3	Mon Mar  3 18:16:14 2003
+++ Zope3/src/zope/app/services/tests/test_cacheconfiguration.py	Tue Mar 18 16:02:23 2003
@@ -105,20 +105,20 @@
         self.rootFolder.setServiceManager(ServiceManager())
 
         self.default = traverse(self.rootFolder,
-                           '++etc++Services/Packages/default')
+                           '++etc++Services/default')
         self.default.setObject('cch', TestCache())
         self.cch = traverse(self.default, 'cch')
 
         self.cm = ZopeContainerAdapter(traverse(self.default, "configure"))
         self.cm.setObject('', CacheConfiguration('cache_name',
-                            '/++etc++Services/Packages/default/cch'))
+                            '/++etc++Services/default/cch'))
         self.config = traverse(self.default, 'configure/1')
 
         self.default.setObject('cache_srv', CachingServiceStub())
         self.service = traverse(self.default, 'cache_srv')
 
         self.cm.setObject('', ServiceConfiguration('Caching',
-                            '/++etc++Services/Packages/default/cache_srv'))
+                            '/++etc++Services/default/cache_srv'))
         traverse(self.default, 'configure/2').status = Active
 
     def tearDown(self):


=== Zope3/src/zope/app/services/tests/test_cachingservice.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/services/tests/test_cachingservice.py:1.4	Mon Feb  3 10:59:17 2003
+++ Zope3/src/zope/app/services/tests/test_cachingservice.py	Tue Mar 18 16:02:23 2003
@@ -57,7 +57,7 @@
         if not folder.hasServiceManager():
             self.createServiceManager(folder)
 
-        default = traverse(folder, '++etc++Services/Packages/default')
+        default = traverse(folder, '++etc++Services/default')
         key = default.setObject("myCachingService", CachingService())
         service = traverse(default, key)
 
@@ -75,7 +75,7 @@
         if not cname:
             cname = name
         default = traverse(self.rootFolder,
-                           folder +'/++etc++Services/Packages/default')
+                           folder +'/++etc++Services/default')
         key = default.setObject(cname, cache)
         cache = traverse(default, key)
         configure = traverse(default, 'configure')


=== Zope3/src/zope/app/services/tests/test_configurationregistry.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/services/tests/test_configurationregistry.py:1.2	Wed Dec 25 09:13:20 2002
+++ Zope3/src/zope/app/services/tests/test_configurationregistry.py	Tue Mar 18 16:02:23 2003
@@ -44,7 +44,7 @@
         root = self.rootFolder
 
         root.setServiceManager(ServiceManager())
-        self.__default = traverse(root, "++etc++Services/Packages/default")
+        self.__default = traverse(root, "++etc++Services/default")
         self.__registry = ContextWrapper(ConfigurationRegistry(), root)
 
     def __config(self, name):


=== Zope3/src/zope/app/services/tests/test_connectionconfiguration.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_connectionconfiguration.py:1.3	Mon Mar  3 18:16:14 2003
+++ Zope3/src/zope/app/services/tests/test_connectionconfiguration.py	Tue Mar 18 16:02:23 2003
@@ -95,20 +95,20 @@
         self.rootFolder.setServiceManager(ServiceManager())
 
         self.default = traverse(self.rootFolder,
-                           '++etc++Services/Packages/default')
+                           '++etc++Services/default')
         self.default.setObject('da', TestDA())
         self.da = traverse(self.default, 'da')
 
         self.cm = ZopeContainerAdapter(traverse(self.default, "configure"))
         self.cm.setObject('', ConnectionConfiguration('conn_name',
-                            '/++etc++Services/Packages/default/da'))
+                            '/++etc++Services/default/da'))
         self.config = traverse(self.default, 'configure/1')
 
         self.default.setObject('conn_srv', ConnectionServiceStub())
         self.service = traverse(self.default, 'conn_srv')
 
         self.cm.setObject('', ServiceConfiguration('SQLDatabaseConnections',
-                            '/++etc++Services/Packages/default/conn_srv'))
+                            '/++etc++Services/default/conn_srv'))
         traverse(self.default, 'configure/2').status = Active
 
     def tearDown(self):


=== Zope3/src/zope/app/services/tests/test_connectionservice.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_connectionservice.py:1.3	Mon Mar  3 18:16:14 2003
+++ Zope3/src/zope/app/services/tests/test_connectionservice.py	Tue Mar 18 16:02:23 2003
@@ -79,26 +79,26 @@
         self.rootFolder.setServiceManager(ServiceManager())
 
         self.default = traverse(self.rootFolder,
-                                '++etc++Services/Packages/default')
+                                '++etc++Services/default')
         self.default.setObject('conn_srv', ConnectionServiceForTests())
         self.service = traverse(self.default, 'conn_srv')
 
         self.cm = ZopeContainerAdapter(traverse(self.default, "configure"))
         self.cm.setObject('', ServiceConfiguration('SQLDatabaseConnections',
-                                '/++etc++Services/Packages/default/conn_srv'))
+                                '/++etc++Services/default/conn_srv'))
         traverse(self.default, 'configure/1').status = Active
 
         self.default.setObject('da1', DAStub(1))
         self.default.setObject('da2', DAStub(2))
 
         self.cm.setObject('', ConnectionConfiguration('conn1',
-                                '/++etc++Services/Packages/default/da1'))
+                                '/++etc++Services/default/da1'))
         traverse(self.default, 'configure/2').status = Active
         self.cm.setObject('', ConnectionConfiguration('conn2',
-                                '/++etc++Services/Packages/default/da2'))
+                                '/++etc++Services/default/da2'))
         traverse(self.default, 'configure/3').status = Active
         self.cm.setObject('', ConnectionConfiguration('conn3',
-                                '/++etc++Services/Packages/default/da1'))
+                                '/++etc++Services/default/da1'))
         traverse(self.default, 'configure/4').status = Registered
         # Now self.service has conn1 and conn2 available and knows about conn3
 
@@ -106,23 +106,23 @@
         folder1 = traverse(self.rootFolder, 'folder1')
         folder1.setServiceManager(ServiceManager())
 
-        default1 = traverse(folder1, '++etc++Services/Packages/default')
+        default1 = traverse(folder1, '++etc++Services/default')
         default1.setObject('conn_srv1', ConnectionServiceForTests())
         self.service1 = traverse(default1, 'conn_srv1')
 
         cm1 = ZopeContainerAdapter(traverse(default1, "configure"))
         cm1.setObject('', ServiceConfiguration('SQLDatabaseConnections',
-                '/folder1/++etc++Services/Packages/default/conn_srv1'))
+                '/folder1/++etc++Services/default/conn_srv1'))
         traverse(default1, 'configure/1').status = Active
 
         default1.setObject('da3', DAStub(3))
         default1.setObject('da4', DAStub(4))
 
         cm1.setObject('', ConnectionConfiguration('conn1',
-                            '/folder1/++etc++Services/Packages/default/da3'))
+                            '/folder1/++etc++Services/default/da3'))
         traverse(default1, 'configure/2').status = Active
         cm1.setObject('', ConnectionConfiguration('conn4',
-                            '/folder1/++etc++Services/Packages/default/da4'))
+                            '/folder1/++etc++Services/default/da4'))
         traverse(default1, 'configure/3').status = Active
         # Now self.service1 overrides conn1, adds new conn4 available, and
         # inherits conn2 from self.service


=== Zope3/src/zope/app/services/tests/test_eventservice.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/services/tests/test_eventservice.py:1.15	Sun Mar 16 10:44:05 2003
+++ Zope3/src/zope/app/services/tests/test_eventservice.py	Tue Mar 18 16:02:23 2003
@@ -845,11 +845,11 @@
             self.folder2.setServiceManager(ServiceManager())
 
         sm = traverse(self.rootFolder, 'folder2/++etc++Services')
-        default = traverse(sm, 'Packages/default')
+        default = traverse(sm, 'default')
 
         default.setObject("myEventService", service)
 
-        path = "%s/Packages/default/myEventService" % getPhysicalPathString(sm)
+        path = "%s/default/myEventService" % getPhysicalPathString(sm)
         configuration = ServiceConfiguration(EventPublication, path)
         default['configure'].setObject("myEventServiceDir", configuration)
         traverse(default, 'configure/1').status = Active


=== Zope3/src/zope/app/services/tests/test_module.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_module.py:1.3	Thu Jan  9 08:51:20 2003
+++ Zope3/src/zope/app/services/tests/test_module.py	Tue Mar 18 16:02:23 2003
@@ -57,7 +57,7 @@
     def test_resolve(self):
         self.rootFolder.setServiceManager(ServiceManager())
         sm = traverse(self.rootFolder, "++etc++Services")
-        default = traverse(sm, "Packages/default")
+        default = traverse(sm, "default")
         default.setObject('m1', Manager())
         manager = traverse(default, "m1")
         manager.new('zope.app.services.tests.sample1',


=== Zope3/src/zope/app/services/tests/test_serviceconfiguration.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/tests/test_serviceconfiguration.py:1.5	Tue Mar 11 11:11:31 2003
+++ Zope3/src/zope/app/services/tests/test_serviceconfiguration.py	Tue Mar 18 16:02:23 2003
@@ -82,14 +82,14 @@
         self.rootFolder.setServiceManager(ServiceManager())
         defineService('test_service', ITestService)
         default = traverse(self.rootFolder,
-                           '++etc++Services/Packages/default')
+                           '++etc++Services/default')
         self.__default = default
 
         default.setObject('c', TestService())
 
 
         configuration = ServiceConfiguration(
-            'test_service', '/++etc++Services/Packages/default/c')
+            'test_service', '/++etc++Services/default/c')
 
         self.__c = traverse(default, 'c')
         self.__cm = ZopeContainerAdapter(traverse(default, "configure"))
@@ -119,10 +119,10 @@
 
     def test_afterAddHook(self):
         self.assertEqual(self.__c._dependents,
-                         ('/++etc++Services/Packages/default/configure/1', ))
+                         ('/++etc++Services/default/configure/1', ))
         u = getAdapter(self.__c, IUseConfiguration)
         self.assertEqual(list(u.usages()),
-                         ['/++etc++Services/Packages/default/configure/1'])
+                         ['/++etc++Services/default/configure/1'])
 
     def test_beforeDeleteHook_and_unregistered(self):
         self.__config.status = Registered
@@ -155,7 +155,7 @@
             TypeError,
             ServiceConfiguration,
             'test_service',
-            '/++etc++Services/Packages/default/c2',
+            '/++etc++Services/default/c2',
             self.__default
             )
 


=== Zope3/src/zope/app/services/tests/test_servicemanager.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/services/tests/test_servicemanager.py:1.2	Wed Dec 25 09:13:20 2002
+++ Zope3/src/zope/app/services/tests/test_servicemanager.py	Tue Mar 18 16:02:23 2003
@@ -56,51 +56,39 @@
     def testGetService(self):
         self.createServiceManager()
         sm = traverse(self.rootFolder, '++etc++Services')
-        default = traverse(sm, 'Packages/default')
+        default = traverse(sm, 'default')
 
         ts = TestService()
         default.setObject('test_service1', ts)
         configuration = ServiceConfiguration(
             'test_service',
-            '/++etc++Services/Packages/default/test_service1')
+            '/++etc++Services/default/test_service1')
 
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/1').status = Active
 
         testOb = getService(self.rootFolder, 'test_service')
         c = getWrapperContainer
-        self.assertEqual(c(c(c(c(testOb)))), self.rootFolder)
+        self.assertEqual(c(c(c(testOb))), self.rootFolder)
         self.assertEqual(testOb, ts)
 
     def test_get(self):
         self.createServiceManager()
         sm = traverse(self.rootFolder, '++etc++Services')
-        default = traverse(sm, 'Packages/default')
-
-        ts = TestService()
-        default.setObject('test_service1', ts)
-        configuration = ServiceConfiguration(
-            'test_service',
-            '/++etc++Services/Packages/default/test_service1')
-
-        default['configure'].setObject('', configuration)
-        traverse(default, 'configure/1').status = Active
-
-        testOb = sm.get('test_service')
-        self.assertEqual(testOb, ts)
-        testOb = sm.get('test_service2')
-        self.assertEqual(testOb, None)
+        default = sm.get('default')
+        self.assertEqual(default, sm.Packages['default'])
+        self.assertEqual(sm.get('spam'), None)
 
     def testAddService(self):
         self.createServiceManager()
         sm = traverse(self.rootFolder, '++etc++Services')
-        default = traverse(sm, 'Packages/default')
+        default = traverse(sm, 'default')
 
         ts1 = TestService()
         default.setObject('test_service1', ts1)
         configuration = ServiceConfiguration(
             'test_service',
-            '/++etc++Services/Packages/default/test_service1')
+            '/++etc++Services/default/test_service1')
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/1').status = Active
 
@@ -108,7 +96,7 @@
         default.setObject('test_service2', ts2)
         configuration = ServiceConfiguration(
             'test_service',
-            '/++etc++Services/Packages/default/test_service2')
+            '/++etc++Services/default/test_service2')
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/2').status = Registered
 
@@ -125,7 +113,7 @@
         self.testGetService() # set up localservice
 
         sm = traverse(self.rootFolder, '++etc++Services')
-        traverse(sm, 'Packages/default/configure/1').status = Unregistered
+        traverse(sm, 'default/configure/1').status = Unregistered
 
         self.assertEqual(getService(self.rootFolder, 'test_service'), root_ts)
 
@@ -133,7 +121,7 @@
         self.testGetService() # set up localservice
         sm=getServiceManager(self.rootFolder)
         self.assertEqual(getService(self.folder1_1, 'test_service'),
-                         sm.Packages['default']['test_service1'])
+                         sm['default']['test_service1'])
 
     def testContextServiceLookupWithMultipleServiceManagers(self):
         self.testGetService() # set up root localservice
@@ -143,7 +131,7 @@
         sm2=getServiceManager(self.folder1)
 
         self.assertEqual(getService(self.folder1, 'test_service'),
-                         sm.Packages['default']['test_service1'])
+                         sm['default']['test_service1'])
 
     def testComponentArchitectureServiceLookup(self):
         self.rootFolder.setServiceManager(ServiceManager())
@@ -165,8 +153,7 @@
 
         self.rootFolder.setServiceManager(ServiceManager())
         sm=getServiceManager(self.rootFolder)
-        Packages = cw(sm.Packages, sm, name='Packages')
-        default = cw(Packages['default'], Packages, name='Packages')
+        default = cw(sm['default'], self.rootFolder, name='Packages')
         default.setObject('m1', Manager())
         manager = cw(default['m1'], default, name='m1')
         manager.new('zope.app.services.tests.sample1',
@@ -177,8 +164,7 @@
 
         self.folder1.setServiceManager(ServiceManager())
         sm2=getServiceManager(self.folder1)
-        Packages = cw(sm2.Packages, sm2, name='Packages')
-        default = cw(Packages['default'], Packages, name='Packages')
+        default = cw(sm2['default'], self.folder1, name='Packages')
         default.setObject('m1', Manager())
         manager = cw(default['m1'], default, name='m1')
         manager.new('zope.app.services.tests.sample1',


=== Zope3/src/zope/app/services/tests/test_view.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/services/tests/test_view.py:1.6	Tue Mar 11 11:11:31 2003
+++ Zope3/src/zope/app/services/tests/test_view.py	Tue Mar 18 16:02:23 2003
@@ -128,7 +128,7 @@
 
         sm = traverse(self.rootFolder, '++etc++Services')
 
-        configure = traverse(sm, 'Packages/default/configure')
+        configure = traverse(sm, 'default/configure')
         configuration = Configuration()
         configure.setObject('', configuration)
         configuration = traverse(configure, '1')
@@ -163,7 +163,7 @@
 
         sm = traverse(self.rootFolder, '++etc++Services')
 
-        configure = traverse(sm, 'Packages/default/configure')
+        configure = traverse(sm, 'default/configure')
         configuration = Configuration()
         configure.setObject('', configuration)
         configuration = traverse(configure, '1')
@@ -228,7 +228,7 @@
         PlacefulSetup.setUp(self)
         self.rootFolder = RootFolder()
         self.rootFolder.setServiceManager(PhonyServiceManager())
-        default = traverse(self.rootFolder, '++etc++Services/Packages/default')
+        default = traverse(self.rootFolder, '++etc++Services/default')
         self.__template = PhonyTemplate()
         default.setObject('t', self.__template)
 
@@ -236,7 +236,7 @@
         configuration = ContextWrapper(
             PageConfiguration(I1, 'test', 'zope.View',
                               "Foo.Bar.A",
-                              template='/++etc++Services/Packages/default/t',
+                              template='/++etc++Services/default/t',
                               ),
             self.rootFolder,
             )
@@ -277,7 +277,7 @@
         c = C()
         request = TestRequest()
         self.assertRaises(ConfigurationError, configuration.getView, c, request)
-        configuration.template = '/++etc++Services/Packages/default/t'
+        configuration.template = '/++etc++Services/default/t'
         configuration.attribute = 'run'
         self.assertRaises(ConfigurationError, configuration.getView, c, request)
 


=== Zope3/src/zope/app/services/tests/test_viewpackage.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/tests/test_viewpackage.py:1.5	Tue Feb 11 10:59:58 2003
+++ Zope3/src/zope/app/services/tests/test_viewpackage.py	Tue Mar 18 16:02:23 2003
@@ -35,7 +35,7 @@
     def test_setObject(self):
         self.buildFolders()
         self.rootFolder.setServiceManager(ServiceManager())
-        default = traverse(self.rootFolder, '++etc++Services/Packages/default')
+        default = traverse(self.rootFolder, '++etc++Services/default')
         default.setObject('Views', ViewPackage())
         views = traverse(default, 'Views')
         views.forInterface = I
@@ -47,7 +47,7 @@
         configure = traverse(default, 'configure')
         configuration = ServiceConfiguration(
             'Views',
-            '/++etc++Services/Packages/default/ViewService')
+            '/++etc++Services/default/ViewService')
         configure.setObject('', configuration)
         configuration = traverse(configure, '1')
         configuration.status = Active