[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ObjectHub/tests - ObjectHubSetup.py:1.3
Jim Fulton
jim@zope.com
Sat, 30 Nov 2002 13:37:18 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ObjectHub/tests
In directory cvs.zope.org:/tmp/cvs-serv12019/lib/python/Zope/App/OFS/Services/ObjectHub/tests
Modified Files:
ObjectHubSetup.py
Log Message:
Updated to reflect new configuration framework.
=== Zope3/lib/python/Zope/App/OFS/Services/ObjectHub/tests/ObjectHubSetup.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ObjectHub/tests/ObjectHubSetup.py:1.2 Tue Nov 26 14:02:49 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ObjectHub/tests/ObjectHubSetup.py Sat Nov 30 13:37:17 2002
@@ -20,11 +20,12 @@
from Zope.App.OFS.Services.LocalEventService.tests.EventSetup import \
EventSetup
from Zope.ComponentArchitecture import getServiceManager
-from Zope.App.OFS.Services.ServiceManager.ServiceDirective \
- import ServiceDirective
-from Zope.App.Traversing import getPhysicalPathString
+from Zope.App.OFS.Services.ServiceManager.ServiceConfiguration \
+ import ServiceConfiguration
+from Zope.App.Traversing import getPhysicalPathString, traverse
from Zope.App.OFS.Services.ObjectHub.ObjectHub import ObjectHub
+from Zope.App.OFS.Services.ConfigurationInterfaces import Active
class ObjectHubSetup(EventSetup):
@@ -36,16 +37,29 @@
global_service_manager.defineService("ObjectHub", IObjectHub)
self.createObjectHub()
- def createObjectHub(self, folder=None):
- if folder is None:
- folder = self.rootFolder
+ def createObjectHub(self, path=None):
+ folder = self.rootFolder
+ if path is not None:
+ folder = traverse(folder, path)
+
if not folder.hasServiceManager():
self.createServiceManager(folder)
- sm = getServiceManager(folder) # wrapped now
- sm.Packages['default'].setObject("myObjectHub", ObjectHub())
+
+ sm = traverse(folder, '++etc++Services')
+ default = traverse(sm, 'Packages/default')
+ default.setObject("myObjectHub", ObjectHub())
path = "%s/Packages/default/myObjectHub" % getPhysicalPathString(sm)
- directive = ServiceDirective("ObjectHub", path)
- sm.Packages['default'].setObject("myObjectHubDir", directive)
- sm.bindService(directive)
+ configuration = ServiceConfiguration("ObjectHub", path)
+
+ configure = traverse(default, 'configure')
+ configure.setObject("myObjectHubDir", configuration)
+
+ for i in range(1, 100):
+ c = traverse(configure, str(i))
+ if c == configuration:
+ break
+ i += 1
+
+ c.status = Active