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

Christian Klinger cklinger at novareto.de
Tue Nov 27 08:55:56 UTC 2012


Hi Joshua,

can you verify if the subscriber.zcml from zope.catalog is loaded?
You can make a typo in this file and see if your instance starts.

If it's not loaded you should include it to your configure.zcml

Christian

Joshua Immanuel schrieb:
> 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
> ApplicationInitializedEvent
> https://mail.zope.org/pipermail/grok-dev/2009-October/008766.html
>
> 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
>              grok.notify(grok.ObjectCreatedEvent(my_default_object))
>              my_folder['default_object'] = my_default_object
>              app_root['my_folder'] = my_folder
>              transaction.commit()
>
> 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?
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list