[Zope-CMF] opaque items, events

Gregoire Weber gregweb at gmx.ch
Mon Dec 6 17:32:04 EST 2004


Hi Florent,

At 18:16 06.12.2004 +0100, Florent Guillaume wrote:
>I never realized this had been checked in in CMFCatalogAware:
>
>+        # Other opaque items than 'talkback' may have callable
>+        # manage_after* and manage_before* hooks.
>+        # Loop over all attributes and add those to 'items'
>+        # implementing 'ICallableOpaqueItemWithHooks'.
>+        self_base = aq_base(self)
>+        for name in self_base.__dict__.keys():
>+            obj = getattr(self_base, name)
>+            if ICallableOpaqueItemWithHooks.isImplementedBy(obj):
>+                items.append((obj.id, obj))
>
>I'm really concerned, this is extremely costly. *All* instance attributes will be interated upon, and then we'll have to get each subobject from the ZODB (argh!!!) to check what it implements.

Hmmm, I see the possible issue with ZODB loads.
Did you encounter concrete performance issues?


>Is there any way to remove this?

I don't like the idea of this beeing removed without any replacement.
 
What if only attributes get checked not starting with a underscore?
Or better having a registry where one could register attribute names to be checked?


>Who uses ICallableOpaqueItems? I know CMFUid does, and it pains me to say that, but any proper UID implementation should use an event system to hook itself into the framework. And CMFUid is really heavy code too. I mean, three tools to manage simple uids... I can't see myself using it as is...

What's the problem with having three tools? 
Each tool for itself is really lightweight, IMHO. 
For app programmers only one is important: portal_uidhandler, the API is similar to the zope3 one.
If you don't like the simple counter implementation replace the portal_uidgenerator 
tool by your own one.


>We really need to add events to Zope 2 or CMF. Zope 3 couldn't live without them, CPS couldn't live without them. Many many ugliness, such as this explicit manage_after* and business, goes away when they are available.

I agree, having a event system in CMF would be much better!
I did the OpaqueItem stuff in january because there wasn't any event system.

Gregoire



More information about the Zope-CMF mailing list