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

Anthony Baxter anthony@interlink.com.au
Sat, 2 Aug 2003 13:28:01 -0400


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

Modified Files:
	catalog.py 
Log Message:
As a result of getAdapter, any queries that needed to be adapted returned
a security proxy wrapped result. Strip it, because you can't intersect an
IISet and a security proxied IISet. :)


=== Zope3/src/zope/app/catalog/catalog.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/catalog/catalog.py:1.8	Mon Jul 14 04:33:39 2003
+++ Zope3/src/zope/app/catalog/catalog.py	Sat Aug  2 13:27:57 2003
@@ -11,6 +11,7 @@
 from zope.app.interfaces.event import ISubscriber
 from zope.app.interfaces.annotation import IAttributeAnnotatable
 from zope.app.interfaces.services.utility import ILocalUtility
+from zope.security.proxy import trustedRemoveSecurityProxy
 
 from zope.app.interfaces.container import IDeleteNotifiable, IAddNotifiable
 from zope.app.interfaces.container import IContainer
@@ -67,16 +68,16 @@
 
     def clearIndexes(self):
         for index in self.values():
-	    index.clear()
+            index.clear()
 
     def updateIndexes(wrapped_self):
-	eventF = Hub.ObjectRegisteredHubEvent
+        eventF = Hub.ObjectRegisteredHubEvent
         objectHub = getService(wrapped_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():
-		index.notify(evt)
+        allobj = objectHub.iterObjectRegistrations()
+        for location, hubid, wrapped_object in allobj:
+            evt = eventF(objectHub, hubid, location, wrapped_object)
+            for index in wrapped_self.values():
+                index.notify(evt)
     updateIndexes = ContextMethod(updateIndexes)
 
     def subscribeEvents(wrapped_self, update=True):
@@ -130,6 +131,10 @@
                 raise ValueError, "no such index %s"%(key)
             index = getAdapter(index, ISimpleQuery)
             results = index.query(value)
+            # Hm. As a result of calling getAdapter, I get back
+            # security proxy wrapped results from anything that
+            # needed to be adapted.
+            results = trustedRemoveSecurityProxy(results)
             if pendingResults is None:
                 pendingResults = results
             else: