[Grok-dev] getUtility requires context!?
Achim Domma
domma at procoders.net
Thu Jul 22 14:54:58 EDT 2010
Hi,
I have an application defined like this:
class Myproj(grok.Application, grok.Container):
grok.local_utility(zope.intid.IntIds, provides=zope.intid.interfaces.IIntIds)
In the interactive debugger I do the following:
root['test'] = proj = Myproj()
proj['content'] = c = MyContent("xx")
ids = getUtility(IIntIds,context=proj)
ids = getUtility(IIntIds)
The first call to getUtility works fine, but the the second one fails with a ComponentLookupError. What do I have to do, to make it work? In my code I want to call getUtility inside an adapter. self.context is a child of my application and derived from grok.Model. If I pass self.context as context to getUtility, the call fails too.
Any hint?
cheers,
Achim
More information about the Grok-dev
mailing list