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

Christian Klinger <[email protected]>
Newsgroups gmane.comp.web.zope.bluebream,gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi,

what do you mean with "via zope.formlib AddForms's createAndAdd' method.

Do you override this method? If so this is wrong you only have to
add a create method which get's called before the object is persisted in 
the container. The createAndAdd method triggers then the catalog.

HTH Christian


> 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.
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.