[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog - ZCatalog.py:1.121.2.1

Shane Hathaway shane@zope.com
Fri, 17 Jan 2003 23:10:10 -0500


Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv7977

Modified Files:
      Tag: Zope-2_6-branch
	ZCatalog.py 
Log Message:
Some indexes were storing acquisition wrappers in the cyclic references
back to the ZCatalog instance.  Removed the acquisition wrappers and
cleaned up a bad use of apply().  The acquisition wrappers were revealed
by AdaptableStorage.

Now, there's a second problem here: most indexes don't even know that they are
storing cyclic references to the ZCatalog!  UnIndex.py doesn't
actually happen to use the second argument in its constructor--it stores it
as ignore_ex, and nothing ever uses ignore_ex.  So the ignore_ex attribute
of most indexes, as it turns out, is a reference back to the ZCatalog.
ignore_ex was intented to be a boolean value, not a persistent object,
and certainly not a cyclic reference.

This is a maddening, ugly situation, but it doesn't do any
harm to Zope itself, whereas fixing it might break plugin indexes not
managed by Zope Corp.  So we have to remember that the ignore_ex
attribute of catalog indexes is now taboo.  Don't use it for its original
purpose.  Rename it.



=== Zope/lib/python/Products/ZCatalog/ZCatalog.py 1.121 => 1.121.2.1 ===
--- Zope/lib/python/Products/ZCatalog/ZCatalog.py:1.121	Wed Aug 28 13:07:24 2002
+++ Zope/lib/python/Products/ZCatalog/ZCatalog.py	Fri Jan 17 23:10:07 2003
@@ -19,7 +19,7 @@
 from OFS.FindSupport import FindSupport
 from OFS.ObjectManager import ObjectManager
 from DateTime import DateTime
-from Acquisition import Implicit
+from Acquisition import Implicit, aq_base
 from Persistence import Persistent
 from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
 from DocumentTemplate.DT_Util import Eval
@@ -894,9 +894,9 @@
         # for new index types is to use an "extra" record.
 
         if 'extra' in base.__init__.func_code.co_varnames:
-            index = apply(base,(name,), {"extra":extra,"caller":self})
+            index = base(name, extra=extra, caller=aq_base(self))
         else:
-            index = base(name,self)
+            index = base(name, aq_base(self))
 
         self._catalog.addIndex(name,index)