[Zope3-checkins] CVS: Zope3/src/zope/app/catalog - catalog.py:1.10.6.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:04 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	catalog.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/catalog/catalog.py 1.10 => 1.10.6.1 ===
--- Zope3/src/zope/app/catalog/catalog.py:1.10	Sun Aug 17 02:06:08 2003
+++ Zope3/src/zope/app/catalog/catalog.py	Mon Sep  8 14:21:33 2003
@@ -3,7 +3,6 @@
 from persistence import Persistent
 from persistence.dict import PersistentDict
 from zope.interface import implements
-from zope.context import ContextMethod
 from zope.app.zapi import getService, getAdapter
 from zope.app.services.servicenames import HubIds
 from zope.exceptions import NotFoundError
@@ -53,60 +52,53 @@
     def getSubscribed(self): 
         return self._subscribed
 
-    def afterAddHook(wrapped_self, object, container):
-        wrapped_self.subscribeEvents(update=False)
-    afterAddHook = ContextMethod(afterAddHook)
+    def afterAddHook(self, object, container):
+        self.subscribeEvents(update=False)
 
-    def beforeDeleteHook(wrapped_self, object, container):
+    def beforeDeleteHook(self, object, container):
         " be nice, unsub ourselves in this case "
-        if wrapped_self._subscribed:
-            wrapped_self.unsubscribeEvents()
-    beforeDeleteHook = ContextMethod(beforeDeleteHook)
+        if self._subscribed:
+            self.unsubscribeEvents()
 
     def clearIndexes(self):
         for index in self.values():
             index.clear()
 
-    def updateIndexes(wrapped_self):
+    def updateIndexes(self):
         eventF = Hub.ObjectRegisteredHubEvent
-        objectHub = getService(wrapped_self, HubIds) 
+        objectHub = getService(self, HubIds) 
         allobj = objectHub.iterObjectRegistrations()
         for location, hubid, wrapped_object in allobj:
             evt = eventF(objectHub, hubid, location, wrapped_object)
-            for index in wrapped_self.values():
+            for index in self.values():
                 index.notify(evt)
-    updateIndexes = ContextMethod(updateIndexes)
 
-    def subscribeEvents(wrapped_self, update=True):
-        if wrapped_self._subscribed: 
+    def subscribeEvents(self, update=True):
+        if self._subscribed: 
             raise ValueError, "Already subscribed"
-        wrapped_self._subscribed = True
-        objectHub = getService(wrapped_self, HubIds) 
-        objectHub.subscribe(wrapped_self, IHub.IRegistrationHubEvent)
-        objectHub.subscribe(wrapped_self, IHub.IObjectModifiedHubEvent)
+        self._subscribed = True
+        objectHub = getService(self, HubIds) 
+        objectHub.subscribe(self, IHub.IRegistrationHubEvent)
+        objectHub.subscribe(self, IHub.IObjectModifiedHubEvent)
         if update:
-            wrapped_self.updateIndexes()
+            self.updateIndexes()
 
-    subscribeEvents = ContextMethod(subscribeEvents)
-
-    def unsubscribeEvents(wrapped_self):
-        if not wrapped_self._subscribed: 
+    def unsubscribeEvents(self):
+        if not self._subscribed: 
             raise ValueError, "Already unsubscribed"
-        wrapped_self._subscribed = False
-        objectHub = getService(wrapped_self, HubIds) 
+        self._subscribed = False
+        objectHub = getService(self, HubIds) 
         try:
-            objectHub.unsubscribe(wrapped_self, IHub.IRegistrationHubEvent)
-            objectHub.unsubscribe(wrapped_self, IHub.IObjectModifiedHubEvent)
+            objectHub.unsubscribe(self, IHub.IRegistrationHubEvent)
+            objectHub.unsubscribe(self, IHub.IObjectModifiedHubEvent)
         except NotFoundError:
             # we're not subscribed. bah.
             pass
 
-    unsubscribeEvents = ContextMethod(unsubscribeEvents)
-
-    def notify(wrapped_self, event):
+    def notify(self, event):
         "objecthub is my friend!"
 
-        indexes = wrapped_self.values()
+        indexes = self.values()
         if (IHub.IObjectRegisteredHubEvent.isImplementedBy(event) or
             IHub.IObjectModifiedHubEvent.isImplementedBy(event)):
             addobj = event.object
@@ -117,13 +109,12 @@
                 index.notify(event)
             except:
                 pass
-    notify = ContextMethod(notify)
 
-    def searchResults(wrapped_self, **searchterms):
+    def searchResults(self, **searchterms):
         from zodb.btrees.IIBTree import intersection
         pendingResults = None
         for key, value in searchterms.items():
-            index = wrapped_self.get(key)
+            index = self.get(key)
             if not index: 
                 raise ValueError, "no such index %s"%(key)
             index = getAdapter(index, ISimpleQuery)
@@ -140,10 +131,9 @@
                 # nothing left, short-circuit
                 break
         # Next we turn the IISet of hubids into a generator of objects
-        objectHub = getService(wrapped_self, HubIds) 
+        objectHub = getService(self, HubIds) 
         results = ResultSet(pendingResults, objectHub)
         return results
-    searchResults = ContextMethod(searchResults)
 
 class CatalogUtility(CatalogBase):
     "A Catalog in service-space"




More information about the Zope3-Checkins mailing list