[Zope3-checkins] CVS: Zope3/src/zope/app/services - service.py:1.34
Jim Fulton
jim at zope.com
Thu Dec 18 03:01:19 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv12584/src/zope/app/services
Modified Files:
service.py
Log Message:
Renamed IServiceManager to ISiteManager.
Added a containment constraint so that only site-management folders
can be contained in site managers.
=== Zope3/src/zope/app/services/service.py 1.33 => 1.34 ===
--- Zope3/src/zope/app/services/service.py:1.33 Fri Dec 5 09:42:01 2003
+++ Zope3/src/zope/app/services/service.py Thu Dec 18 03:01:18 2003
@@ -31,7 +31,8 @@
from zope.app import zapi
from zodb.code.module import PersistentModuleRegistry
-from zope.interface import implements
+import zope.interface
+import zope.app.interfaces.services.registration
from zope.component import getServiceManager
from zope.component.exceptions import ComponentLookupError
@@ -39,10 +40,12 @@
from zope.app.component.nextservice import getNextService
from zope.app.component.nextservice import getNextServiceManager
+from zope.app.container.constraints import ItemTypePrecondition
+
from zope.app.interfaces.container import IContainer
from zope.app.interfaces.services.service import IBindingAware
from zope.app.interfaces.services.service import IServiceRegistration
-from zope.app.interfaces.services.service import IServiceManager
+from zope.app.interfaces.services.service import ISiteManager
from zope.app.services.registration import NameComponentRegistry
from zope.app.services.registration import NamedComponentRegistration
@@ -57,11 +60,24 @@
from zope.app.interfaces.services.service import ISite
from zope.app.location import inside
-class SiteManager(BTreeContainer,
- PersistentModuleRegistry,
- NameComponentRegistry):
+class IRegistrationManagerContainerContainer(zope.interface.Interface):
+
+ def __setitem__(name, folder):
+ """Add a site-management folder
+ """
+ __setitem__.precondition = ItemTypePrecondition(
+ zope.app.interfaces.services.registration.IRegistrationManagerContainer)
- implements(IServiceManager)
+class SiteManager(
+ BTreeContainer,
+ PersistentModuleRegistry,
+ NameComponentRegistry,
+ ):
+
+ zope.interface.implements(
+ ISiteManager,
+ IRegistrationManagerContainerContainer,
+ )
def __init__(self, site):
self.__parent__ = site
@@ -90,7 +106,7 @@
return
def addSubsite(self, sub):
- """See IServiceManager interface
+ """See ISiteManager interface
"""
subsite = sub.__parent__
@@ -154,7 +170,7 @@
def queryLocalService(wrapped_self, name, default=None):
- """See IServiceManager
+ """See ISiteManager
"""
# This is rather tricky. Normally, getting a service requires
@@ -246,7 +262,7 @@
__doc__ = IServiceRegistration.__doc__
- implements(IServiceRegistration)
+ zope.interface.implements(IServiceRegistration)
serviceType = 'Services'
More information about the Zope3-Checkins
mailing list