Where is my BtreeFolder stored?
Hi All, I can now create BTreeFolders and add,remve items to and from it but how and where does zope store my folders,does the id indicate the folder I'm storing in? This is in an external method: 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 = OOBStuff(uniq_id,{'a':1,'b':2}) f._setOb(uniq_id, obT) lst = f.objectItems() return lst def test4(): if 'suftest' in aq_parent.objectIds(): return 'True' class OOBStuff(BTreeFolder2): meta_type ='OOBStuff' def __init__(self, oid,dict_to_add): super(OOBStuff, self).__init__(oid) self.item = OOBTree() self.item['Auth'] = dict_to_add def return_Tree(self): return self.item Running test4 gives this error: Error Type: AttributeError Error Value: 'builtin_function_or_method' object has no attribute 'objectIds' Also, how come my BTFolder didn't show up anywhere in the ZMI? I have imported aq_base and aq_parent. 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
On 27.11.2008 16:09 Uhr, Mr SZ wrote:
def test4(): if 'suftest' in aq_parent.objectIds(): return 'True'
Running test4 gives this error: Error Type: AttributeError Error Value: 'builtin_function_or_method' object has no attribute 'objectIds'
...because you are guessing code and syntax. Either use obj.aq_parent or aq_parent(obj) for getting hold of the acquisition parent of 'obj'. -aj
Mr SZ wrote at 2008-11-27 07:09 -0800:
... def test4(): if 'suftest' in aq_parent.objectIds(): return 'True'
class OOBStuff(BTreeFolder2): meta_type ='OOBStuff' def __init__(self, oid,dict_to_add): super(OOBStuff, self).__init__(oid) self.item = OOBTree() self.item['Auth'] = dict_to_add def return_Tree(self): return self.item
Running test4 gives this error: Error Type: AttributeError Error Value: 'builtin_function_or_method' object has no attribute 'objectIds'
"aq_parent" obviously is the object, you have imported from "Acquisition". This is a function and obviously does not have an "objectIds". You need to apply "aq_parent" to some object to (hopefully) get an object with "objectIds". -- Dieter
participants (3)
-
Andreas Jung -
Dieter Maurer -
Mr SZ