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

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


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

Modified Files:
	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.124 => 1.125 ===
--- Zope/lib/python/Products/ZCatalog/ZCatalog.py:1.124	Tue Feb 25 11:54:40 2003
+++ Zope/lib/python/Products/ZCatalog/ZCatalog.py	Mon Mar  3 13:15:18 2003
@@ -907,15 +907,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=self)
+        elif 'caller' in base.__init__.func_code.co_varnames:
+            index = base(name, caller=self)
         else:
-            index = base(name, self)
+            index = base(name)
 
         self._catalog.addIndex(name,index)