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

R. Sean Bowman sean.bowman@acm.org
Thu, 20 Feb 2003 20:36:24 -0500


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

Modified Files:
	subscribers.py 
Log Message:
fixed Registration (by changing it back to how it worked before...),
added a comment explaining why things are the way they are


=== Zope3/src/zope/app/index/subscribers.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/index/subscribers.py:1.7	Tue Feb 11 21:17:23 2003
+++ Zope3/src/zope/app/index/subscribers.py	Thu Feb 20 20:36:23 2003
@@ -37,7 +37,7 @@
 from zope.app.interfaces.content.folder import IFolder
 from zope.proxy.context import ContextMethod
 from zope.component import getService, queryAdapter
-from zope.app.services.servicenames import HubIds, Events
+from zope.app.services.servicenames import HubIds
 
 from zope.app.traversing import traverse, traverseName, \
      getPhysicalPath, getPhysicalRoot
@@ -71,7 +71,9 @@
     def subscribe(wrapped_self):
         if wrapped_self.currentlySubscribed:
             raise RuntimeError, "already subscribed; please unsubscribe first"
-        events = getService(wrapped_self, Events)
+        # we subscribe to the HubIds service so that we're
+        # guaranteed to get exactly the events *that* service receives.
+        events = getService(wrapped_self, HubIds)
         events.subscribe(wrapped_self, IObjectAddedEvent)
         wrapped_self.currentlySubscribed = True
     subscribe = ContextMethod(subscribe)
@@ -79,7 +81,7 @@
     def unsubscribe(wrapped_self):
         if not wrapped_self.currentlySubscribed:
             raise RuntimeError, "not subscribed; please subscribe first"
-        events = getService(wrapped_self, Events)
+        events = getService(wrapped_self, HubIds)
         events.unsubscribe(wrapped_self, IObjectAddedEvent)
         wrapped_self.currentlySubscribed = False
     unsubscribe = ContextMethod(unsubscribe)