[BlueBream] [Zope-dev] Reg. updating catalog indexes in bluebream

Thierry Florac tflorac at ulthar.net
Thu Jun 23 18:12:05 EDT 2011

Le Thu, 23 Jun 2011 21:49:34 +0530, Joshua Immanuel <josh at hipro.co.in>
a �crit:

> On Thu, 2011-06-23 at 17:19 +0200, Charlie Clark wrote:
> > The indices do have to be updated every time you add, delete or
> > modify an object. This is one of the reasons for the event system
> > you were asking  about the other week.
> As the size of sm['intids'] were getting incremented as and when new
> objects were added, without me doing anything explicitly about it. I
> was of the notion that I don't need to explicitly update the indexes. 

If added object implements ILocation, ObjectAddedEvent subscriber
generates an automatic IntId registration, and a new IntIdAddedEvent
event is fired, which is catched by Catalog indexDocSubscriber to
handle automatic cataloging of added objects. ObjectModifiedEvent event
is directly handled by Catalog reindexDocSubscriber to handle index

> If I subscribe for 'IContainerModifiedEvent' for the container of
> 'Client' object and update the indexes, then I think I'll miss out if
> just the attributes of 'Client' object is modified. So, I think along
> with this I should subscribe for 'IObjectModifiedEvent' of 'Client'
> object. 
> Will this be sufficient? Is there any other better way of doing this?

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

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:

    myEvent = ObjectModifiedEvent(myObject)

Most form handling packages (zope.formlib, z3c.form) automatically
handle these events notifications if their base classes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/bluebream/attachments/20110624/160f6cfb/attachment.bin 

More information about the bluebream mailing list