[Zope] Internal reference between objects saved in ZODB gets lost?

Dieter Maurer dieter@handshake.de
Tue, 4 Sep 2001 23:54:02 +0200 (CEST)


Max M writes:
 > If I create two objects and saves them with 'setObject' any references
 > between objects is lost. Is that true?
 > 
 > Simple stoopid non-working code example::
 > 
 > class test:
 >     def __init__(self, id, otherObject=None):
 >         self.id = id
 >         self.otherObject= otherObject
 > 
 > class table(ObjectManager):
 > 
 >     def __init__(self):
 >         object1 = test('1')
 >         object2 = test('2', object1)
 >         self._setObject('1')
 >         self._setObject('2', object2)
The "self._setObject('1')" looks a bit strange (no "object" parameter),
but otherwise, it should work (I think).

Maybe, it helps when you derive "test" from "Persistent".


Dieter