[Grok-dev] indexes not getting updated for contents added via ApplicationInitializedEvent subscriber

Joshua Immanuel josh at hipro.co.in
Mon Nov 26 09:29:33 UTC 2012

Hello all,
I was trying to add some default contents for my application upon the
initialization of Site. So, I added a subscriber for
ApplicationInitializedEvent. In that subscriber I tried adding an object
which has some indexes attached with it. Though the object gets added
successfully but the catalog indexes for it are not getting updated.
However, the indexes are updated if the object is added via formlib.

Upon searching the archives I found this thread which talks about the

This is how my subscriber looks like

        @grok.subscribe(IMyRoot, grok.ApplicationInitializedEvent)
        def cbAppRootAdded(app_root, event):
            catalog = component.queryUtility(ICatalog, context=app_root)
            # catalog is not None
            intids = component.queryUtility(
                IIntIds, context=app_root, default=None)
            # intids is also not None
            my_folder = MyFolder() # grok.Container object
            my_default_object = MyObject(...) # grok.Model object
            my_folder['default_object'] = my_default_object
            app_root['my_folder'] = my_folder

I even tried adding the default object via IObjectAddedEvent subscriber
for IMyFolder. Still, the indexes for MyObject were not getting updated.

Am I missing something?
Joshua Immanuel
HiPro IT Solutions Private Limited
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20121126/a1f280ac/attachment.sig>

More information about the Grok-dev mailing list