[Zope] Re: using a ZODB standalone app with Zope

Istvan Albert ialbert at mailblocks.com
Fri Feb 18 10:13:40 EST 2005


Chris Withers wrote:

> container.getPhysicalRoot()
> 
> ...but it sounds like you're after something else, what are you trying 
> to do?

Turns out this does not quite work as I expected. It returns an Application
and not a Zope root.

My biggest problem in describing what I want to do is that it is
seemingly too simple. Sometimes that gets in the way. Simply put
I want to use Zope's ZODB as ZODB and not as a high level
Zope object. With a standalone ZODB I would do something like this:

from ZODB import FileStorage, DB
from BTrees.OOBTree import OOBTree
storage = FileStorage.FileStorage('test.fs')
db = DB(storage)
conn = db.open()
dbroot = conn.root()
dbroot['foo'] = OOBTree()
dbroot['foo'][1] = 'bar'
get_transaction().commit()
db.pack()
print dbroot['foo'][1]

how would I achieve this exact same result from within Zope say with a
python script that operates on the ZODB that Zope uses to store its objects
(usually Data.fs)?

thanks,

Istvan.



More information about the Zope mailing list