[Zope-CMF] call opaque items others than 'talkback' in
CMFCore/CMFCatalogAware.py
Gregoire Weber
gregweb at gmx.ch
Tue Sep 2 16:01:26 EDT 2003
Three weeks ago I proposed a change in the current HEAD of CMF ...
... but nobody answered to my question. :-(
Anybody there to have a look about this?
Gregoire
At 12:34 11.08.2003 +0200, Grégoire Weber wrote:
>Hi all,
>
>I propose the following to allow other opaque items than 'talkback'
>to be called on 'manage_after*' and 'manage_before*' events.
>
>The proposed code change is fully backwards compatible.
>
>Comments?
>
>Gregoire
>
>-------------------------------------------------------------------------
>Change CMFCore/CMFCatalogAware.py (diff is done on the current HEAD):
>
>$ diff CMFCatalogAware.py CMFCatalogAware_New.py
>24a25
>> from Interfaces.ICallableOpaqueItem import ICallableOpaqueItem
>113,115c114,118
>< # Since 'talkback' is the only opaque item on content
>< # right now, I will return that. Should be replaced with
>< # a list of tuples for every opaque item!
>---
>> items = []
>>
>> # Call 'talkback knowing that it is an opaque item.
>> # This will remain here as long as the a discussion item does
>> # not implement ICallableOpaqueItem (backwards compatibility).
>119,120c122,134
>< return ((talkback.id, talkback),)
>< return ()
>---
>> items.append((talkback.id, talkback))
>>
>> # Other opaque items than 'talkback' may have callable
>> # manage_after* and manage_before* methods.
>> # Loops over all attributes and checks if they implement
>> # ICallableOpaqueItem.
>> for name in self.__dict__.keys():
>> if not name.startswith('_'): # XXX Does that make sense?
>> obj = getattr(self, name)
>> if ICallableOpaqueItem.isImplementedBy(obj):
>> items.append((obj.id, obj))
>>
>> return tuple(items)
>
>-------------------------------------------------------------------------
>New interface in CMFCore/Interfaces/ICallableOpaqueItem.py:
>
>class ICallableOpaqueItem(Interface):
> """Marker interface for callable opaque items
> """
>_____________________________________
>Grégoire Weber
>mailto:gregoire.weber at switzerland.org
>
>
>_______________________________________________
>Zope-CMF maillist - Zope-CMF at zope.org
>http://mail.zope.org/mailman/listinfo/zope-cmf
>
>See http://collector.zope.org/CMF for bug reports and feature requests
_____________________________________
Grégoire Weber
mailto:gregoire.weber at switzerland.org
More information about the Zope-CMF
mailing list