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

Chris Withers chris at simplistix.co.uk
Tue Feb 22 14:20:39 EST 2005


Istvan Albert wrote:
> 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 BTrees.OOBTree import OOBTree
replace these bits...
> from ZODB import FileStorage, DB
> storage = FileStorage.FileStorage('test.fs')
> db = DB(storage)
> conn = db.open()
> dbroot = conn.root()
> dbroot['foo'] = OOBTree()
> dbroot['foo'][1] = 'bar'
...with:
dbroot = self.getPhysicalRoot()
dbroot.foo = OOBTree()
dbroot.foo[1] = 'bar'

You won;t be abel to do this from a python script, since OOBTree and 
direct attribute assignment are not available to 'untrusted code' (ie: 
python scripts)

Use an external method instead.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope mailing list