OOBTrees are created as attributes on zopeish objects (e.g. BTreeFolder2). E.g.
class Stuff(BTreeFolder2): meta_type ='Stuff' def __init__(self, oid): super(Stuff, self).__init__(oid) self.people = OOBTree() 2008/11/25 Mr SZ <[EMAIL PROTECTED]>: > Hi All, > > I am writing a product to manage the back end operations of users.I need to > store lots of user info.My first plan was to use ZSQL but then I read about > ZODB and more specifically OOBTrees and BTreeFolder2. My objective is to > store user related stuff on ZODB but not litter the ZODB but to instead > organize into folders. I read the test code and the BTreeFolder.py to figure > out the API. > > I have a few doubts to clarify: > > In this method I tried to add two BTFs and an OOBTree: > def test3(): > f = BTreeFolder2('sufest') > f2 = BTreeFolder2('somefolder') > f3 = BTreeFolder2('somefolder2') > f._setObject(f2.id, f2) > f._setObject(f3.id, f3) > uniq_id = f.generateId() > obT = OOBTree() > obT['Auth'] = {'a':1,'b':2} > f._setOb(uniq_id, obT) > lst = f.objectMap() > > return f._getOb(uniq_id) > > Now the functions returns an error: > Traceback (innermost last): > Module ZPublisher.Publish, line 115, in publish > Module ZPublisher.mapply, line 88, in mapply > Module ZPublisher.Publish, line 41, in call_object > Module Products.ExternalMethod.ExternalMethod, line 225, in __call__ > - __traceback_info__: ((), {}, None) > Module /var/lib/zope2.9/instance/sandbox/Products/Test/Extensions/Tst.py, > line 40, in test3 > Module Products.BTreeFolder2.BTreeFolder2, line 211, in _getOb > AttributeError: 'BTrees._OOBTree.OOBTree' object has no attribute '__of__' > > I beleive this is because OOBTrees don't have a meta_type which the _getOb > function tries to access. Enlighten me :) > > Other methods like objectMap and getBatchObjectListing work fine though. > > My question is how do we properly a store any item other than zope objects > like strings,dicts or OOBTrees in a BTreeFolder2 and how to retrieve them > back. > > Zope seems interesting to work with but at times really confuses me > especially acquisition concepts. > > Regards, > SZ > > > " life isn't heavy enough,it flies away and floats far above action" > > > > Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now > http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline > _______________________________________________ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )