On Thu, 2006-14-12 at 23:04 +0100, Florian Lindner wrote: > I have a object, derived from Persistent when contain one attribute which is > not serializable and that's not a problem for me, but Zope complains about > that. > Can I mark this attribute somehow as "not to serialize" and make Zope call a > member function when it has unserialized this object so I can reinstantiate > this attribute?
It *sounds* like you want _v_ attributes. So you should probably do something like this... class MyClass(persistent.Persistent): @property def myattr(self): if not hasattr(self, '_v_myattr'): self._v_myattr = somecalculatedvalue return self._v_myattr so then you can do: myobj = MyClass() print myobj.myattr This will give you the content you want but you don't have to worry about it getting persisted. Regards, Rocky ps. I'm pulling over my zope2 knowledge here so if I did something a little naive, please forgive me :) -- Rocky Burt ServerZen Software -- http://www.serverzen.com News About The Server (blog) -- http://www.serverzen.net
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com