Add an object and subobjects in a single pass?
Hello, I'm working with the Kube Product, and I have a situation where I would like to add a Kube (for those who are not familiar with it, it is basically a folder) and then add another Kube within the first -- but do it during a single pass. Currently, I have the following: (foo and bar are specializations of Kube -- they have the same interface, tho) id1, id2 = 'f', 'b' f = foo() f.id = id1 f.title = 'Foo Object' self._setObject(id1, f) f = self._getOb(id1) b = bar() b.id = id2 b.title = 'Bar Object' self._setObject(id2, b) b = self._getOb(id2) From here I have tried f.bar = b, f._setObject('bar', b) Both of these create a bar object that is a subobject of foo. I can go to http://host/foo/bar and I see bar. However, when I look at foo, I can't see bar as a subobject (like a folder would normally show a subobject.) Also, I add properties to bar, but I can't seem to get at them anywhere through the management interface. Any help? Thanks, VL
VanL <vlindberg@verio.net> wrote:
id1, id2 = 'f', 'b'
f = foo() f.id = id1 f.title = 'Foo Object' self._setObject(id1, f) f = self._getOb(id1)
b = bar() b.id = id2 b.title = 'Bar Object' self._setObject(id2, b)
you want f._setObject(id2, b)
b = self._getOb(id2)
and here b = f._getOb(id2) Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
participants (2)
-
Florent Guillaume -
VanL