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

John Smith jsmith030416 at yahoo.co.uk
Wed Dec 14 15:37:40 EST 2005


Dear Jim,

> Did you try IBuddy? ;)

It was IBuddy that got me into this ! (mutters darkly
under breath)

My utility bears a strong resemblance to IPostalLookup
:)

Anyhow, I am pleased to report success, and thank you
for your pointers.

The lines below are for the benefit of google anyone
else who has the same problem.

0. How to access the Zope3 ZODB application root and
programmatically add content objects.

1. Upgrade to Zope 3.1.0

2. from ZODB.interfaces import IDatabase

3. db = zapi.getUtility(IDatabase)

4. conn = db.open()

5. root = conn.root().data['Application']

6. root['newobject']=<some new object> or navigate to
where you need to go

7. conn.getTransaction.commit()

and tidy up.


John





		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com


More information about the Zope3-users mailing list