On Fri, 2011-06-24 at 00:12 +0200, Thierry Florac wrote:
You don't have to subscribe to IContainerModifiedEvent or IObjectModifiedEvent: zope.intid and zope.catalog packages already provide subscribers for these events to automatically handle updates of indexes.
What you have to do is just to generate an ObjectAddedEvent or ObjectModifiedEvent when your object is added or modified, and notify subscribers for it:
When I add my object to its container via zope.formlib AddForm's createAndAdd method like this cl = Client() ... self.context[cid] = cl (P.S: I didn't explicitly notify the ObjectAddedEvent.) In setitem function of zope.container.contained 'notify(ObjectAddedEvent)' happens, this causes the 'addIntIdSubscriber' adapter of zope.intid to be called. This in turn registers the 'Client' object and notifies for 'IntIdAddedEvent'. But I don't see the 'indexDocSubscriber' of zope.catalog.catalog which is the adapter for 'IIntIdAddedEvent' being called. Why is this so? So, sm['intids'] is getting updated as and when new objects are added but the catalog indexes are not getting updated. Am I missing something? Or is there any specific zcml configuration needed for this? Please guide me. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in