Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread Benji York
Tom Gross wrote: you are trying to lookup the utility with the name None. If you don't specify a name when registering the utility, omit the second parameter: zapi.getUtility(IInitIndicator) In other words, the name of an unnamed utility isn't None, but the empty string. -- Benji York Se

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread Tom Gross
Hi Frank, you are trying to lookup the utility with the name None. If you don't specify a name when registering the utility, omit the second parameter: zapi.getUtility(IInitIndicator) Cheers -Tom FB wrote: On Tue, Dec 12, 2006 at 05:29:55PM +0300, Garanin Michael wrote: FB wrote:

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
Hi, On Tue, Dec 12, 2006 at 04:14:31PM +0100, David Johnson wrote: > Try: > -- > utils = zapi.getAllUtilitiesRegisteredFor(IYourInterface) > for util in utils: > print util > -- > > You can list all the returned utilities. See if your utility is returned, and > see what name it is > registe

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
On Tue, Dec 12, 2006 at 05:29:55PM +0300, Garanin Michael wrote: > FB wrote: > >On Tue, Dec 12, 2006 at 04:42:56PM +0300, Garanin Michael wrote: > > > >>traceback, please. > >> > > > >Hmm ... how? It just doesn't return the utility as expected (it returns > >None). There is no error shown in

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread David Johnson
Try: -- utils = zapi.getAllUtilitiesRegisteredFor(IYourInterface) for util in utils: print util -- You can list all the returned utilities. See if your utility is returned, and see what name it is registered under. If not, try with a known interface. Can you provide the results here?

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread Garanin Michael
FB wrote: On Tue, Dec 12, 2006 at 04:42:56PM +0300, Garanin Michael wrote: traceback, please. Hmm ... how? It just doesn't return the utility as expected (it returns None). There is no error shown in any way. from APIDOC: """ * *|getUtility(interface, name='', context=None)|

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
On Tue, Dec 12, 2006 at 04:42:56PM +0300, Garanin Michael wrote: > FB wrote: > >Hi, > > > >is there any reason why a registered utility which is persistently stored > >inside the site > >manager is never found via zapi.getUtility(IMyInterface) ? > > > >More information: > > > >I wrote a package (

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread Garanin Michael
FB wrote: Hi, is there any reason why a registered utility which is persistently stored inside the site manager is never found via zapi.getUtility(IMyInterface) ? More information: I wrote a package ( fb ) containing some components making the developer's life easier. The package provides a

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
Hi, On Tue, Dec 12, 2006 at 01:54:01PM +0100, Tom Gross wrote: > Hi Frank, > >is your InitIndicator-instance implementing the > IInitIndicatorFB-interface. This is absolutely > necessary > for providing it as an utility. There's an easy test for this: > > >>> from zope.interface.verify imp

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread Tom Gross
Hi Frank, is your InitIndicator-instance implementing the IInitIndicatorFB-interface. This is absolutely necessary for providing it as an utility. There's an easy test for this: >>> from zope.interface.verify import verifyObject >>> ii = InitIndicator() >>> verifyObject(IInitIndicatorFB, ii

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
Hi, On Tue, Dec 12, 2006 at 07:56:53AM +1100, Tom Dossis wrote: > FB wrote: > > Hi, > > > > is there any reason why a registered utility which is persistently stored > > inside the site > > manager is never found via zapi.getUtility(IMyInterface) ? > > > > More information: > > > > I wrote a p

Re: [Zope3-Users] Registered utility is never found

2006-12-12 Thread FB
Hi, On Mon, Dec 11, 2006 at 11:41:25PM +0100, David Johnson wrote: > >Hi, > > > >is there any reason why a registered utility which is persistently stored > >inside the site > >manager is never found via zapi.getUtility(IMyInterface) ? > It's been my experience this is caused by registering with