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

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


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

Modified Files:
	servicecontainer.py 
Log Message:
Set site-manager names and parents.

Change the way the ISite interface is declared so as not to override
other instance declarations (e.g. IRootFolder).

Refactored notification interfaces.


=== Zope3/src/zope/app/services/servicecontainer.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/servicecontainer.py:1.5	Tue Sep  2 16:46:50 2003
+++ Zope3/src/zope/app/services/servicecontainer.py	Sun Sep 21 13:33:02 2003
@@ -19,10 +19,12 @@
 from zope.component.exceptions import ComponentLookupError
 from zope.app.interfaces.services.service import IPossibleSite, ISite
 from zope.component.interfaces import IServiceService
+from zope.interface import implements
+from zope.app.container.contained import Contained
 from zope.app import zapi
 import zope.interface
 
-class ServiceManagerContainer:
+class ServiceManagerContainer(Contained):
 
     """Implement access to the service manager (++etc++site).
 
@@ -46,10 +48,15 @@
 
         if IServiceService.isImplementedBy(sm):
             self.__sm = sm
+            sm.__name__ = '++etc++site'
+            sm.__parent__ = self
         else:
             raise ValueError('setSiteManager requires an IServiceService')
 
-        zope.interface.directlyProvides(self, ISite)
+        zope.interface.directlyProvides(
+            self,
+            ISite,
+            zope.interface.directlyProvidedBy(self))
 
 
 
@@ -62,9 +69,10 @@
         database = event.database
         connection = database.open()
         app = connection.root().get('Application')
-        if app is None:
+        if app is None or ISite.isImplementedBy(app):
             # No old data
             return
+        print "Fixing up sites that don't implement ISite"
         fixfolder(app)
         get_transaction().commit()
         connection.close()
@@ -80,7 +88,11 @@
     except ComponentLookupError:
         pass # nothing to do
     else:
-        zope.interface.directlyProvides(folder, ISite)
+        zope.interface.directlyProvides(
+            folder,
+            ISite,
+            zope.interface.directlyProvidedBy(folder),
+            )
 
     for item in folder.values():
         if IPossibleSite.isImplementedBy(item):




More information about the Zope3-Checkins mailing list