Paavo Parkkinen wrote at 2003-7-21 19:47 +0300:
On ke, 09.07.2003 at 20:55 +0200, Dieter Maurer wrote:
Is it possible that your "ZCatalog" is not yet acquisition wrapped when you call "addIndex"?
I finally had some time to take a look at this problem a little deeper, and it seems that the ZCatalog is not aquisition wrapped when calling 'addIndex'. This problem seems to be fixed in 2.7.0-a1.
Here's a patch for the 2.6.1 users:
--- ZCatalog.py.orig 2003-07-21 19:31:55.000000000 +0300 +++ ZCatalog.py 2003-07-21 19:45:21.000000000 +0300 @@ -894,7 +894,7 @@ # 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) else: index = base(name, aq_base(self))
The same problem is also in the "else:" clause. There is another bug in this code (which is horrible under all accounts): "co_varnames" is used as if it were the sequence of arguments. However, as the name clearly suggests: it is the sequence of (all) variables in the code objects. This includes arguments and local variables. If "base" does not have an "extra" argument but a local variable called "extra", the code above will fail with a "TypeError: unexpected keyword argument 'extra'". This error is not very likely but when it happens deep Python Zen is necessary to understand what happened. Dieter