[Zope] Save references in a list as object attribut

Vladislav Vorobiev vavvav at mykniga.de
Fri Jan 29 04:44:20 EST 2010


Hello,

I try to save references to objects as attribute in a list.

object.refList=getattr([self.
context.pfad, 'object'],
[self.context.pfad, 'object1'])

After adding and transaction commit I can get my linked objects with
all attributes and methods

myObject.refList
[<myType at object>]

myObject.refList[0].objectValues()[0].getPhysicalPath()
('', 'path', 'object')

myObject.refList[0].objectValues()[0].absolute_url()
http://localhost/pfad/object

I restart the instance and get some other results

myObject.refList
[<myType at object>]

myObject.refList[0].objectValues()[0].getPhysicalPath()
('object',)

myObject.refList[0].objectValues()[0].absolute_url()
'object'

It seems that the in list referenced object ist no more in context
after restart.

the constructor for this looks like:

object  = myObject()
id=myObject
myObject.id   = id
myObject.title= id
myObject.refList=getattr([self.context.pfad, 'object'],
[self.context.pfad, 'object1'])
self.context._setObject(id, ob)

The references without list object.ref=objectreference working after 
restart.
Similar conducts Set und PersistentList.
Whats the problem anybody an idea? Can anybody reproduce the problem?

Zope2.12, python2.6

--
Best Regards
Vlad Vorobiev


More information about the Zope mailing list