[Zope-CMF] opaque items, events

Florent Guillaume fg at nuxeo.com
Mon Dec 6 12:16:56 EST 2004


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.

Is there any way to remove this?

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...

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.

Currently CPS monkey-patches Zope and CMF to publish events on object 
creation/destruction/clone. Could we add these simple hooks before the 
rest of the framework is in place ?

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-CMF mailing list