[Zope-CMF] [CMF 2.1] opaque items calls make performance issue

toutpt toutpt at gmail.com
Mon Aug 10 02:45:03 EDT 2009


Charlie Clark a écrit :
> Am 09.08.2009, 04:48 Uhr, schrieb Martin Aspeli <optilude+lists at gmail.com>:
>
>   
>>>> self_base = aq_base(self)
>>>> for name in self_base.__dict__.keys()
>>>>    obj = getattr(self, name)
>>>>    if ICallableOpaqueItem.providedBy(obj):
>>>>      items.append((obj.getId(), obj))
>>>>         
>> That's just *nuts*!
>>     
>
>  From my previous answer to this which I forgot to send to the list as well  
> - can we change the list settings so that answers go to it by default?
>
>
> CMF maintains pretty extensive backwards compatability.
>
> A similar question came up a couple of years ago and produced this  
> response from Tres:
>
> http://mail.zope.org/pipermail/zope-cmf/2007-March/025754.html
>
> ie. there is no reason why this should not be deprecated and replaced.
>
> Returning to the original questions:
>
> But z2ICallableOpaqueItem is a Zope2 interface and I m not used to this
> kind of object. It seems they are generated on runtime, so for me it's
> hard to debug.
>
> No, it's simply renamed on import in CMFCatalogAware
>
> * What are opaqueitems (any example ? I don't have find anything usefull
> in tests of CMFCore)
>
>      """ Interface for callable opaque items.
>
>      o Opaque items are subelements that are contained using something that
>        is not an ObjectManager.
>
>      o On add, copy, move and delete operations, a marked opaque items
>        'manage_afterAdd', 'manage_afterClone' and 'manage_beforeDelete'
>        hooks get called if available. Unavailable hooks do not throw
>        exceptions.
>      """
>
> DiscussionItems are ICallableOpaqueItems
>
> * Is zope2 interface are still used and why ?
>
> For anything that uses OpaqueItems. From Tres' post it's pretty unlikely  
> that this is the case. The z2I "import as" has been removed in CMF trunk.
>
> * How could I replace those calls, or improved this code that always
> return an empty tuple
>
> In you own deployments I suggest simply overriding the code to do just  
> that.
>
> Charlie
>   
Thank you Charlie for this answer  and this "Read The Fucking
Interfaces" ;) .

I have done a simple egg that override the code:
http://pypi.python.org/pypi/experimental.aggressiveopaquespeedup/

- JeanMichel FRANCOIS aka toutpt




More information about the Zope-CMF mailing list