[Zope3-Users] very simple problem with getUtility

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Jan 7 11:07:25 EST 2007


On Sunday 07 January 2007 08:17, Christophe Combelles wrote:
> - I start zope with an empty zodb
> - I add a Folder
> - I go to the registration tab and register it for IFolder as 'foo'
> - I stop zope, and start debugzope:

These steps are okay.

>  >>> from zope.component import getUtility
>  >>> from zope.app.folder.interfaces import IFolder
>  >>> getUtility(IFolder, 'foo')
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "/usr/lib/python2.4/site-packages/zope/component/_api.py", line
> 207, in getUtility
>      raise ComponentLookupError(interface, name)
> zope.component.interfaces.ComponentLookupError: (<InterfaceClass
> zope.app.folder.interfaces.IFolder>, 'foo')

The registration is done locally. You have to set the site first or pass it as 
the context.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list