[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - ServiceManagerContainer.py:1.1.2.7 __init__.py:1.1.6.21 component.zcml:1.1.2.5 IComponentArchitecture.py:NONE

Gary Poster garyposter@earthlink.net
Fri, 17 May 2002 13:16:16 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv15153/ComponentArchitecture

Modified Files:
      Tag: Zope-3x-branch
	ServiceManagerContainer.py __init__.py component.zcml 
Removed Files:
      Tag: Zope-3x-branch
	IComponentArchitecture.py 
Log Message:
1) Fixed some of my own (wrapping) errors in CA and Traversal
2) added IBindingAware interface for services that need to know when they are bound and unbound to a local service manager
3) in subscribables, made event_types into event_type (YAGNI)
4) in subscribables, added ability to unsubscribe per subscription, not just whole-hog
5) in subscribables, added ability to query subscribable for subscriptions of a given subscriber
6) made ISubscribable extremely verbose, to hopefully describe exactly what's going on (see it for more smaller changes)
7) added ISubscriptionAware interface for objects that need to know when they have been subscribed and unsubscribed
8) built out local event service; once there are some views and once I have some more robust tests this *prototype* should by ready to fly.  Note that it is currently a standard service that can be added to any service manager, and thus the design does attempt to address many of the nested service manager issues.
9) as part of this, created the first indirect subscriber (all placeful
subscriptions will usually need to use indirect subscribers in order to retain their context when events are fired): PathSubscriber
10) removed an endless loop between local service managers and  ZopeSecurityPolicy in which both needed the other to function: ZopeSecurityPolicy now explicitly asks for adapters from the global service manager
11) unintentionally retained some of the "default=ComponentLookupError"-type argument signatures from my sandbox, but only within Container and Folder; I won't worry about undoing it though (unless I am otherwise requested) since it seems these interfaces are due for a dict-like overhaul anyway.

Also, if anyone needs a local event service setup for other tests (like the ObjectHub, for instance) see the LocalEventService/tests/EventSetup.py

more tests on the way for the local event service, and for the changes to the subscribable interface



=== Zope3/lib/python/Zope/ComponentArchitecture/ServiceManagerContainer.py 1.1.2.6 => 1.1.2.7 ===
 from IServiceManager import IServiceManager
 from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
-from Zope.Proxy.ContextWrapper import ContextWrapper
-from Zope.ContextWrapper import ContextMethod
 
 _marker = object()
 
@@ -38,18 +36,16 @@
 
         return hasattr(self, '_ServiceManagerContainer__sm')
 
-    def getServiceManager(wrapped_self, default=_marker):
+    def getServiceManager(self, default=_marker):
         '''See interface IReadServiceManagerContainer'''
 
         try:
-            return ContextWrapper(wrapped_self.__sm, wrapped_self) # no name
+            return self.__sm # no name
         except AttributeError:
             if default is _marker:
                 raise ComponentLookupError
             else:
                 return default
-    
-    getServiceManager=ContextMethod(getServiceManager)
 
     def setServiceManager(self, sm):
         '''See interface IWriteServiceManagerContainer'''


=== Zope3/lib/python/Zope/ComponentArchitecture/__init__.py 1.1.6.20 => 1.1.6.21 ===
 __implements__ = IPlacefulComponentArchitecture
 
+from Zope.Proxy.ContextWrapper import getWrapperContainer
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
+
 
 _marker = object() # this exact marker is used throughout CA
 
@@ -35,7 +38,12 @@
     return serviceManager
 
 def getService(context, name):
-    return getServiceManager(context).getService(name)
+    #return getServiceManager(context).getService(name)
+    # XXX we shouldn't need to do this; the above should be sufficient
+    sv=getServiceManager(context).getService(name) 
+    if getWrapperContainer(sv) is None:
+        return removeAllProxies(sv)
+    return sv
 
 def getServiceDefinitions(context): 
     return getServiceManager(context).getServiceDefinitions()


=== Zope3/lib/python/Zope/ComponentArchitecture/component.zcml 1.1.2.4 => 1.1.2.5 ===
 <service name='Utilities'
              component='.GlobalUtilityService.utilityService' />
+<security:protectClass name=".GlobalUtilityService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".IUtilityService+"
+             permission_id="Zope.Public" />
+    <security:protect names="provideUtility"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <serviceType name='Adapters'
              interface='.IAdapterService+' />
 <service name='Adapters'
              component='.GlobalAdapterService.adapterService' />
+<security:protectClass name=".GlobalAdapterService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".IAdapterService+"
+             permission_id="Zope.Public" />
+    <security:protect names="provideAdapter"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <serviceType name='Factories'
              interface='.IFactoryService+' />
 <service name='Factories'
              component='.GlobalFactoryService.factoryService' />
+<security:protectClass name=".GlobalFactoryService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".IFactoryService+"
+             permission_id="Zope.Public" />
+    <security:protect names="provideFactory"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <serviceType name='Skins'
              interface='.ISkinService+' />
 <service name='Skins'
              component='.GlobalSkinService.skinService' />
+<security:protectClass name=".GlobalSkinService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".ISkinService+"
+             permission_id="Zope.Public" />
+    <security:protect names="defineSkin"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <serviceType name='Views' 
              interface='.IViewService+' />
 <service name='Views'
          component='.GlobalViewService.viewService' />
+<security:protectClass name=".GlobalViewService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".IViewService+"
+             permission_id="Zope.Public" />
+    <security:protect names="provideView, setDefaultViewName"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <serviceType name='Resources'
              interface='.IResourceService+' />
 <service name='Resources'
              component='.GlobalResourceService.resourceService' />
+<security:protectClass name=".GlobalResourceService+"
+             permission_id="Zope.Public">
+    <security:protect interface=".IResourceService+"
+             permission_id="Zope.Public" />
+    <security:protect names="provideResource"
+             permission_id="Zope.ManageServices" />
+</security:protectClass>
 
 <hookable name=".getServiceManager" />
 <hookable name=".getNextServiceManager" />

=== Removed File Zope3/lib/python/Zope/ComponentArchitecture/IComponentArchitecture.py ===