[Zope3-Users] zc.relationship or hurry.query and global intid utility

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Jan 8 02:05:51 EST 2007

On Sunday 07 January 2007 07:06, Shaar Gabriel wrote:
> > This utility is the one thing you should create before any other object
> > because objects created prior to this utility will never have a unique
> > ID.
> a debug session :
> daemon manager not running
> zopectl> start
> . ------
> 2007-01-07T13:55:52 INFO root daemonizing the process
> daemon process started, pid=13163
> zopectl> stop
> . daemon process stopped
> zopectl> debug
> No handlers could be found for logger "ZODB.FileStorage"
> >>> from zope.component import getUtility
> >>> from zope.app.intid.interfaces import IIntIds
> >>> getUtility(IIntIds)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/zope-3.3.0/lib/python/zope/component/_api.py", line 207,
> in getUtility
>     raise ComponentLookupError(interface, name)
> zope.component.interfaces.ComponentLookupError: (<InterfaceClass
> zope.app.intid.interfaces.IIntIds>, '')

In this case you are not in the context of the root site, which contains the 
registration. You have to get the root folder and do:

getUtility(IIntIds, context=rootFolder)

Alternatively, you can do the hooks.setSite trick I showed in the previous 

BTW, instead of using debug sessions, I would write a quick functional test 
with a pdb.set_trace() call. This way you have everything documented as well.

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