[Zope3-checkins] CVS: Zope3/src/zope/app/process - bootstrap.py:1.9

Jim Fulton jim at zope.com
Sun Sep 21 13:33:05 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/process
In directory cvs.zope.org:/tmp/cvs-serv14452/src/zope/app/process

Modified Files:
	bootstrap.py 
Log Message:
Use the rootFolder helper function rather than the RootFolder class.

Changed to use __setitem__ rather than setObject


=== Zope3/src/zope/app/process/bootstrap.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/process/bootstrap.py:1.8	Tue Sep  2 16:46:48 2003
+++ Zope3/src/zope/app/process/bootstrap.py	Sun Sep 21 13:32:34 2003
@@ -26,7 +26,7 @@
 from zope.app.interfaces.event import ISubscriber
 from zope.app.traversing import traverse, traverseName
 from zope.app.publication.zopepublication import ZopePublication
-from zope.app.content.folder import RootFolder
+from zope.app.content.folder import rootFolder
 from zope.app.services.servicenames import HubIds, PrincipalAnnotation
 from zope.app.services.servicenames import EventPublication, EventSubscription
 from zope.app.services.servicenames import ErrorLogging, Interfaces
@@ -69,13 +69,13 @@
 
         if self.root_folder is None:
             self.root_created = True
-            self.root_folder = RootFolder()
+            self.root_folder = rootFolder()
             root[ZopePublication.root_name] = self.root_folder
 
         try:
-            self.service_manager = traverse(self.root_folder, '/++etc++site')
+            self.service_manager = traverse(self.root_folder, '++etc++site')
         except ComponentLookupError:
-            self.service_manager = ServiceManager()
+            self.service_manager = ServiceManager(self.root_folder)
             self.root_folder.setSiteManager(self.service_manager)
 
         self.doSetup()
@@ -90,14 +90,15 @@
         Return the name added, if we added an object, otherwise None.
         """
         package = getServiceManagerDefault(self.root_folder)
-        valid_objects = [ obj for obj in package 
-                          if object_type.isImplementedBy(obj) ]
+        valid_objects = [ name
+                          for name in package 
+                          if object_type.isImplementedBy(package[name]) ]
         if valid_objects:
             return None
         name = object_name + '-1'
         obj = object_factory()
         obj = removeAllProxies(obj)
-        package.setObject(name, obj)
+        package[name] = obj
         return name
 
     def ensureService(self, service_type, service_factory, **kw):
@@ -193,7 +194,7 @@
     name = service_type + '-1'
     service = service_factory()
     service = removeAllProxies(service)
-    package.setObject(name, service)
+    package[name] = service
 
     # Set additional attributes on the service
     for k, v in kw.iteritems():
@@ -207,7 +208,7 @@
     registration =  ServiceRegistration(service_type,
                                         name,
                                         registration_manager)
-    key = registration_manager.setObject("", registration)
+    key = registration_manager.addRegistration(registration)
     registration = traverseName(registration_manager, key)
     registration.status = initial_status
 




More information about the Zope3-Checkins mailing list