[Zope3-checkins] CVS: Zope3/src/zope/app/services - servicecontainer.py:1.2.12.1

Jim Fulton jim@zope.com
Thu, 17 Apr 2003 06:18:27 -0400


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

Modified Files:
      Tag: uk-april-2003-usability-branch
	servicecontainer.py 
Log Message:
Checking Seb's sprint work into a branch

=== Zope3/src/zope/app/services/servicecontainer.py 1.2 => 1.2.12.1 ===
--- Zope3/src/zope/app/services/servicecontainer.py:1.2	Tue Feb  4 05:30:07 2003
+++ Zope3/src/zope/app/services/servicecontainer.py	Thu Apr 17 06:17:56 2003
@@ -13,7 +13,8 @@
 ##############################################################################
 
 from zope.component.exceptions import ComponentLookupError
-from zope.app.interfaces.services.service import IServiceManagerContainer  
+from zope.app.interfaces.services.service import IServiceManagerContainer
+from zope.app.interfaces.services.service import IActiveServiceManagerContainer
 from zope.component.interfaces import IServiceService
 
 class ServiceManagerContainer:
@@ -42,6 +43,19 @@
 
         if IServiceService.isImplementedBy(sm):
             self.__sm = sm
+            # Now mark the container as Active
+            # XXX this is a Bad Way to set interfaces, soon to
+            # be replaced with the New Way, by stevea ?
+            # (see BetterInterfaceImplements proposal)
+            interfaces_to_add = (IActiveServiceManagerContainer,)
+            impl = self.__implements__
+            
+            if isinstance(impl, tuple):
+                impl = interfaces_to_add + impl
+            else:
+                impl =  interfaces_to_add + (impl,)
+            self.__implements__ = impl
+            
         else:
             raise ValueError('setServiceManager requires an IServiceService')