[ZCM] [ZC] 1332/ 5 Comment "Catalog needs to wean itself off of BTrees Length as __len__ for HEAD"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Oct 12 11:45:39 EDT 2004


Issue #1332 Update (Comment) "Catalog needs to wean itself off of BTrees Length as __len__ for HEAD"
 Status Accepted, Zope/bug critical
To followup, visit:
  http://collector.zope.org/Zope/1332

==============================================================
= Comment - Entry #5 by ajung on Oct 12, 2004 11:45 am

A fix with a in-place migration for the __len__ magic
is checked into the SVN (ZCatalog.py/Catalog.py). Could someone
please review the migration?

I also removed some old conversion code for BTrees which should
be obsolete (except for people upgrading from some very
old Zope version (I think Zope 2.4 and older)).  
________________________________________
= Assign - Entry #4 by ajung on Oct 9, 2004 7:35 am

Assigning this issue to me. I will try to clean up the code for Zope 2.8 and provide a migration solution for Zope 2.7.4.
________________________________________
= Assign - Entry #3 by ajung on Oct 9, 2004 7:35 am

 Status: Pending => Accepted

 Supporters added: ajung


________________________________________
= Comment - Entry #2 by ajung on Oct 4, 2004 3:20 pm

Fixing the problem in the code is not the real problem but migration is. 

We could change the code for 2.7.4 and add some migration mechanism (a dedicated method that moves the counter from
__len__ to some other attribute. Upgrading from 2.7 to 2.8
would require a former migration under 2.7.4 and we could
clean up the implementation on the SVN trunk.
________________________________________
= Request - Entry #1 by mcdonc on May 15, 2004 5:46 pm

The Catalog uses a BTrees Length object as it's instance's __len__, but this no longer works as expected on the HEAD when the Catalog is a new-style class (as per BTrees Length module docs):

    It is tempting to to assign length objects to __len__ attributes
    to provide instance-specific __len__ methods. However, this no
    longer works as expected, because new-style classes cache
    class-defined slot methods (like __len__) in C type slots.  Thus,
    instance-define slot fillers are ignores.

==============================================================



More information about the Zope-Collector-Monitor mailing list