[Grok-dev] getUtility requires context!?
domma at procoders.net
Thu Jul 22 14:54:58 EDT 2010
I have an application defined like this:
class Myproj(grok.Application, grok.Container):
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.
More information about the Grok-dev