[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/StartUp - SiteDefinition.py:1.7

Guido van Rossum guido@python.org
Wed, 11 Dec 2002 13:07:26 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/StartUp
In directory cvs.zope.org:/tmp/cvs-serv2590

Modified Files:
	SiteDefinition.py 
Log Message:
Found a simpler way to activate a service.
Added an initial_status argument to _addService(), defaulting to
'Active'.


=== Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py:1.6	Wed Dec 11 13:00:12 2002
+++ Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py	Wed Dec 11 13:07:25 2002
@@ -189,7 +189,8 @@
         self._addService(root_folder, 'ObjectHub', ObjectHub)
 
 
-    def _addService(self, root_folder, service_type, service_factory):
+    def _addService(self, root_folder, service_type, service_factory,
+                    initial_status='Active'):
         """Add and configure a service to the root folder.
 
         The service is added to the default package and activated.
@@ -210,10 +211,7 @@
                                               package_name + (name,))
         key = configuration_manager.setObject(None, configuration)
         configuration = traverseName(configuration_manager, key)
-        service_manager = traverseName(root_folder, '++etc++Services')
-        registry = service_manager.createConfigurations(service_type)
-        registry.register(configuration)
-        registry.activate(configuration)
+        configuration.status = initial_status
 
 
     def __call__(self):