[Zope3-checkins] CVS: Zope3/src/zope/app/startup - bootstrap.py:1.7

Steve Alexander steve@cat-box.net
Sun, 23 Feb 2003 10:09:55 -0500


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

Modified Files:
	bootstrap.py 
Log Message:
Code formatting improvements.
Made sure to remove all proxies from a service before setting it. This
is important if the factory vends things wrapped in a proxy.


=== Zope3/src/zope/app/startup/bootstrap.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/startup/bootstrap.py:1.6	Tue Feb 11 21:17:36 2003
+++ Zope3/src/zope/app/startup/bootstrap.py	Sun Feb 23 10:09:54 2003
@@ -32,6 +32,7 @@
 from zope.app.services.event import EventService
 from zope.app.services.errorr import ErrorReportingService
 from zope.app.services.principalannotation import PrincipalAnnotationService
+from zope.proxy.introspection import removeAllProxies
 
 def bootstrapInstance(db):
     """Bootstrap a Zope3 instance given a database object.
@@ -66,11 +67,11 @@
     root_folder.setServiceManager(service_manager)
     name = addConfigureService(root_folder, Events, EventService)
     configureService(root_folder, Subscription, name)
-    
+
     addConfigureService(root_folder, HubIds, ObjectHub)
     addConfigureService(root_folder, ErrorReports,
                         ErrorReportingService, copy_to_zlog=True)
-    addConfigureService(root_folder, 'PrincipalAnnotation', \
+    addConfigureService(root_folder, 'PrincipalAnnotation',
                         PrincipalAnnotationService)
 
 def addConfigureService(root_folder, service_type, service_factory, **kw):
@@ -85,23 +86,24 @@
     The service is added to the default package and activated.
     This assumes the root folder already has a service manager,
     and that we add at most one service of each type.
-    
+
     Returns the name of the service implementation in the default package.
     """
     # The code here is complicated by the fact that the registry
     # calls at the end require a fully context-wrapped
-    # configuration; hence all the traverse[Name]() calls.
+    # configuration; hence all the traverse() and traverseName() calls.
     package_name = ('', '++etc++Services', 'Packages', 'default')
     package = traverse(root_folder, package_name)
     name = service_type + '-1'
     service = service_factory()
+    service = removeAllProxies(service)
     package.setObject(name, service)
 
     # Set additional attributes on the service
     for k, v in kw.iteritems():
         setattr(service, k, v)
     return name
-        
+
 def configureService(root_folder, service_type, name,
                      initial_status='Active'):
     """Configure a service in the root folder."""