[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/LocalEventService - LocalEventChannel.py:1.5 ProtoServiceEventChannel.py:1.2

Gary Poster gary@zope.com
Thu, 7 Nov 2002 20:33:09 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/LocalEventService
In directory cvs.zope.org:/tmp/cvs-serv29476

Modified Files:
	LocalEventChannel.py ProtoServiceEventChannel.py 
Log Message:
Two small changes: LocalEventChannel returns to the correct subclassing now that a Persistence patch is in, and ProtoServiceEventChannel has a couple of new hooks for binding to another event channel than the event service (like the object hub).




=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalEventChannel.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalEventChannel.py:1.4	Mon Oct 21 02:22:40 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalEventChannel.py	Thu Nov  7 20:33:08 2002
@@ -23,11 +23,7 @@
 from Zope.Proxy.ProxyIntrospection import removeAllProxies
 from Zope.Proxy.ContextWrapper import ContextWrapper
 
-class LocalEventChannel:
-    # a mix-in: also needs LocalSubscribable to work.
-    # LocalSubscribable was in base class but produced
-    # TypeError: multiple bases have instance lay-out conflict
-    # when used in ProtoServiceEventChannel
+class LocalEventChannel(LocalSubscribable):
     
     __implements__ = IEventChannel
     


=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/ProtoServiceEventChannel.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/ProtoServiceEventChannel.py:1.1	Mon Oct 21 02:14:46 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/ProtoServiceEventChannel.py	Thu Nov  7 20:33:08 2002
@@ -32,6 +32,8 @@
 from Interface.Attribute import Attribute
 from Zope.Event.IEventChannel import IEventChannel
 from Zope.App.OFS.Services.ServiceManager.IBindingAware import IBindingAware
+from Zope.Proxy.ContextWrapper import isWrapper
+from Zope.Event.IEvent import IEvent
 
 class ProtoServiceEventChannel(
     LocalSubscriptionAware,
@@ -62,18 +64,27 @@
         # the name of the service that this object is providing, or
         # None if unbound
     
+    _subscribeToServiceName = "Events"
+    _subscribeToServiceInterface = IEvent
+    _subscribeToServiceFilter = None
+    
     def bound(wrapped_self, name):
         "see IBindingAware"
         clean_self=removeAllProxies(wrapped_self)
         clean_self._serviceName = name # for LocalServiceSubscribable
         if clean_self.subscribeOnBind:
-            es=getService(wrapped_self, "Events")
-            if es is not eventService:
-                # XXX if we really want to receive events from the
-                # global event service we're going to have to
+            es=getService(
+                wrapped_self,
+                clean_self._subscribeToServiceName)
+            if isWrapper(es):
+                # if we really want to receive events from a
+                # global event-type service we're going to have to
                 # set something special up--something that subscribes
                 # every startup...
-                es.subscribe(PathSubscriber(wrapped_self))
+                es.subscribe(
+                    PathSubscriber(wrapped_self),
+                    clean_self._subscribeToServiceInterface,
+                    clean_self._subscribeToServiceFilter)
     
     bound=ContextMethod(bound)
     
@@ -89,4 +100,4 @@
         clean_self._serviceName = None
 
     unbound=ContextMethod(unbound)
-    
\ No newline at end of file
+