getUtility() fails from IApplicationInitializedEvent function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

getUtility() fails from IApplicationInitializedEvent function

Àlex Magaz Graça

I'm getting a ComponentLookupError when getUtility() is called in the following function:

@grok.subscribe(Helpdesk, grok.IApplicationInitializedEvent)
def setUpTestUsers(obj, event):
    authPlugin = getUtility(IAuthenticatorPlugin, "users")

According to Grok documentation [1]:

This event can be used to trigger the creation of contents or other tasks that require the application to be fully operational : utilities installed and indexes created in the catalog."

I understand utilities should be ready. In fact, I have a print statement in the utility's __init__() which is executed before getUtility() fails. I've also checked the getUtility() call in the function is the same that is used in other places and working just fine.

Any idea why this fails?



Grok-dev mailing list
[hidden email]