[Zope-CMF] RE: [Zope-dev] Performance problem in ZOPE 2.5.1, 'getOwner' in /lib/python/AccessControl/Owned.py

Stefan H. Holek stefan@epy.co.at
Mon, 09 Sep 2002 11:34:42 +0200


AccessControl.Owned.getOwner takes the truth value of the user folder 
(since 2.4). This in turn calls __len__.

The BasicUserFolder defines __len__ to return 1 (as do all OFS objects 
except Image). This makes a lot of sense to me as more often than not an 
object does not have a "length". It is IMHO a highly questionable 
abstraction to define the "length" of a folder as the number of contained 
items. Same thing for __nonzero__.

Stefan


--On Samstag, 07. September 2002 14:18 +0000 Florent Guillaume 
<fg@nuxeo.com> wrote:

> Stefan H. Holek <stefan@epy.co.at> wrote:
>> Gotcha! I did actually expect that.
>>
>> XUF defines __len__ to return the number of users. This absolutely kills
>> performance on Zope 2.4+
>>
>> See my patch at http://www.zope.org/Members/shh/Patches
>
> Hmm, just curious: what part of the code does (implicitely or
> explicitely) call __len__ on the user folder?
>
> Florent
--
Those who write software only for pay should go hurt some other field.
/Erik Naggum/