[Grok-dev] getUtility() fails from IApplicationInitializedEvent function

Àlex Magaz Graça rivaldi8 at gmail.com
Wed Dec 21 22:10:46 UTC 2011


Hi,

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?

[1] 
http://grok.zope.org/doc/current/reference/events.html#iapplicationinitializedevent

Thanks,
Àlex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20111221/acd148b1/attachment.html>


More information about the Grok-dev mailing list