[Zope3-Users] Get to ZODB root from global utility

John Smith jsmith030416 at yahoo.co.uk
Wed Dec 14 13:06:36 EST 2005


Dear Jim,

I was unable to import IDatabase from ZODB.interfaces,
although I could import IDataManager and IConnection.

However, when I tried:

root = zapi.getUtility(IDataManager)

I got a componentlookuperror. (The same error happens
with IConnection).

Any thoughts?

Thanks for your help,

John



--- Jim Fulton <jim at zope.com> wrote:

> John Smith wrote:
> > Hi,
> > 
> > Does anyone know if there any way to get to the
> main
> > ZODB root of the site other than using
> > zope.app.zapi.getRoot(someObject)?
> > 
> > Here is the background. I want to programatically
> > create new folders underneath the Zope root,
> according
> > to some external source which my zope instance
> polls
> > periodically.
> > 
> > I have made a global utility what spawns a worker
> > thread which creates the folder objects. My
> problem is
> > I don't seem to be able to work out how to get
> hold of
> > the Zope root as I have not get any context.
> 
> Each database defined in zope.conf is registered as
> a ZODB.interfaces.IDatabase with the name given in
> zope.conf.  If you you have only one database and it
> doesn't have a name, then you should be able to look
> up the utility without supplying a name.
> 
> Jim
> 
> -- 
> Jim Fulton           mailto:jim at zope.com      
> Python Powered!
> CTO                  (540) 361-1714           
> http://www.python.org
> Zope Corporation     http://www.zope.com      
> http://www.zope.org
> 



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the Zope3-users mailing list