[Zope3-checkins] CVS: Zope3/src/zope/app/index - processors.py:1.5.4.1 subscribers.py:1.3.4.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:47 -0500


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

Modified Files:
      Tag: paris-copypasterename-branch
	processors.py subscribers.py 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/zope/app/index/processors.py 1.5 => 1.5.4.1 ===
--- Zope3/src/zope/app/index/processors.py:1.5	Mon Dec 30 13:43:06 2002
+++ Zope3/src/zope/app/index/processors.py	Tue Feb 11 09:41:15 2003
@@ -24,6 +24,7 @@
 from zope.app.interfaces.services.query import IQueryProcessor
 
 from zope.component import getAdapter, getService
+from zope.component.servicenames import HubIds
 from zope.proxy.context import ContextMethod
 
 class ObjectRetrievingProcessor:
@@ -41,7 +42,7 @@
         list = getAdapter(query, IRankedHubIdList)
         batch = getAdapter(query, IBatchedResult)
 
-        objectHub = getService(wrapped_self, "HubIds")
+        objectHub = getService(wrapped_self, HubIds)
 
         # XXX do we need wrapping for the objects returned by the hub?
         iterator = RankedObjectIterator(


=== Zope3/src/zope/app/index/subscribers.py 1.3 => 1.3.4.1 ===
--- Zope3/src/zope/app/index/subscribers.py:1.3	Mon Dec 30 09:03:06 2002
+++ Zope3/src/zope/app/index/subscribers.py	Tue Feb 11 09:41:15 2003
@@ -37,6 +37,7 @@
 from zope.app.interfaces.content.folder import IFolder
 from zope.proxy.context import ContextMethod
 from zope.component import getService, queryAdapter
+from zope.component.servicenames import HubIds, Events
 
 from zope.app.traversing import traverse, traverseName, \
      getPhysicalPath, getPhysicalRoot
@@ -61,7 +62,7 @@
 
     def notify(wrapped_self, event):
         """An event occured. Perhaps register this object with the hub."""
-        hub = getService(wrapped_self, "HubIds")
+        hub = getService(wrapped_self, HubIds)
         wrapped_self._registerObject(event.object, hub)
     notify = ContextMethod(notify)
 
@@ -70,16 +71,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)
 
@@ -88,7 +89,7 @@
 
     def registerExisting(wrapped_self):
         object = findContentObject(wrapped_self)
-        hub = getService(wrapped_self, "HubIds")
+        hub = getService(wrapped_self, HubIds)
         wrapped_self._registerTree(object, hub)
     registerExisting = ContextMethod(registerExisting)
 
@@ -114,12 +115,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