[Zope] ZCatalog len problem

Andreas Jung lists at zopyx.com
Sat Mar 24 10:43:17 EDT 2007



--On 24. März 2007 10:16:46 -0400 Jonathan <dev101 at magma.ca> wrote:

> I have a ZCatalog and in the ZMI 'Catalog' tab it reports:
>
> Returns:
>
> len(sRes)=  1820
> cnt=  1842
>

The result remains the same after reindexing the whole catalog?

>
> It looks like the __len__ method in Catalog.py is not returning the
> correct value - it returns self._length() which is set by the following
> method (also in Catalog.py):
>
>     def migrate__len__(self):
>         """ migration of old __len__ magic for Zope 2.8 """
>         if not hasattr(self, '_length'):
>             n = self.__dict__['__len__']()
>             del self.__dict__['__len__']
>             self._length = BTrees.Length.Length(n)
>

Is this migration code for pre-2.8 catalogs. This change was necessary 
because the new ExtensionClass implementation did not longer work
with the scary implementation of the __len__ functionality of the Catalog
class.

If the result remains the same after reindexing the catalog there might be
an issue with the increment/decrement calls of the _length counter
with catalogObject/uncatalogObject...however no idea why...

-aj


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20070324/eade1122/attachment.bin


More information about the Zope mailing list