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

Shane Hathaway shane@zope.com
Mon, 3 Mar 2003 13:14:30 -0500


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

Modified Files:
      Tag: Zope-2_6-branch
	ZCatalog.py 
Log Message:
Reinstated the bugfix that prevents catalogs from accidentally storing
acquisition wrappers, but this time the bugfix is clearer.  The second
argument to an index constructor is usually not "caller"; it's usually
"ignore_ex", which gets stored as a meaningless attribute and ignored.

The bugfix builds upon the ugly code that's already there.  Ugly code
begets ugly code, unfortunately.


=== Zope/lib/python/Products/ZCatalog/ZCatalog.py 1.121.2.1 => 1.121.2.2 ===
--- Zope/lib/python/Products/ZCatalog/ZCatalog.py:1.121.2.1	Fri Jan 17 23:10:07 2003
+++ Zope/lib/python/Products/ZCatalog/ZCatalog.py	Mon Mar  3 13:14:27 2003
@@ -888,15 +888,17 @@
         if base is None:
             raise ValueError, "Index type %s does not support addIndex" % type
 
-        # This code is somewhat lame but every index type has its own
+        # This code is *really* lame but every index type has its own
         # function signature *sigh* and there is no common way to pass
         # additional parameters to the constructor. The suggested way
         # for new index types is to use an "extra" record.
 
         if 'extra' in base.__init__.func_code.co_varnames:
-            index = base(name, extra=extra, caller=aq_base(self))
+            index = base(name, extra=extra, caller=self)
+        elif 'caller' in base.__init__.func_code.co_varnames:
+            index = base(name, caller=self)
         else:
-            index = base(name, aq_base(self))
+            index = base(name)
 
         self._catalog.addIndex(name,index)