To answer my own question - just for the record, in case
someone is having the same difficulties - I found redefining
__getstate__ in Family solved my problem:
...
from zope.security.proxy import removeSecurityProxy
class Family(Persistent):
...
def __getstate__(self):
s=Persistent.__getstate__(self)
s['mother']=removeSecurityProxy(self.mother)
s['father']=removeSecurityProxy(self.father)
return s
On Mon, Apr 25, 2005 at 11:42:25PM +0200, Andreas Reuleaux wrote:
...
Then I tried to make Family persistent, i. e.
from persistent import Persistent
class Family(Persistent):
...
and I learned subobjects should be persistent, too
from persistent import Persistent
class Person(Persistent)
...
Now when I change family objects in the editform I can do so safely
with foo and bar, but changing Mother's or Father's name results in an
error:
UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy'
objects
The complete error log is shown below, too. - It seems to me that
because one has to declare view- (rs. edit-) permissions for Person
require permission=zope.View
interface=.iperson.IPerson
/
Person is wrapped in a security proxy and therefore family can't be
saved (pickeled) any more. - Any idea how to solve this?
I don't have this problem if I only make Person persistent (not
Family) but of course then I am losing changes to the family
attributes foo and bar.
...
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users