[Zope3-checkins] CVS: Zope3/src/zope/app/index - subscribers.py:1.4

R. Sean Bowman sean.bowman@acm.org
Wed, 5 Feb 2003 20:26:16 -0500


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

Modified Files:
	subscribers.py 
Log Message:
subscribe to events from event service (instead of object hub) to send
to object hub 


=== Zope3/src/zope/app/index/subscribers.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/index/subscribers.py:1.3	Mon Dec 30 09:03:06 2002
+++ Zope3/src/zope/app/index/subscribers.py	Wed Feb  5 20:26:13 2003
@@ -70,16 +70,16 @@
     def subscribe(wrapped_self):
         if wrapped_self.currentlySubscribed:
             raise RuntimeError, "already subscribed; please unsubscribe first"
-        channel = wrapped_self._getChannel(None)
-        channel.subscribe(wrapped_self, IObjectAddedEvent)
+        events = getService(wrapped_self, "Events")
+        events.subscribe(wrapped_self, IObjectAddedEvent)
         wrapped_self.currentlySubscribed = True
     subscribe = ContextMethod(subscribe)
 
     def unsubscribe(wrapped_self):
         if not wrapped_self.currentlySubscribed:
             raise RuntimeError, "not subscribed; please subscribe first"
-        channel = wrapped_self._getChannel(None)
-        channel.unsubscribe(wrapped_self, IObjectAddedEvent)
+        events = getService(wrapped_self, "Events")
+        events.unsubscribe(wrapped_self, IObjectAddedEvent)
         wrapped_self.currentlySubscribed = False
     unsubscribe = ContextMethod(unsubscribe)
 
@@ -114,12 +114,6 @@
             # Already registered
             pass
     _registerObject = ContextMethod(_registerObject)
-
-    def _getChannel(wrapped_self, channel):
-        if channel is None:
-            channel = getService(wrapped_self, "HubIds")
-        return channel
-    _getChannel = ContextMethod(_getChannel)
 
 def findContentObject(context):
     # We want to find the (content) Folder in whose service manager we