[Zope] access to other zope objects in __setstate__

Chris Withers chrisw@nipltd.com
Thu, 12 Jun 2003 14:48:33 +0100


Sylvain Thénault wrote:
> 
> do you mean that __setstate__ should never be overriden 

There are incredibly few situations where it's a good idea to override 
__setstate__...

> I used __setstate__ to build a non persistent attribute from some
> persistent data in my object.

I'd suggest using ComptuedAttributes or Python 2.2's 'properties' instead...

> I've discussed with Lennart Regebro about
> my problem and I've finished by putting all my setstate code in a
> method which should be called instead of directly access to the
> attribute, so the attribute is built on the first call.

That's not how __setstate__ works ;-)

cheers,

Chris