[Zope] access to other zope objects in __setstate__

Sylvain Thénault Sylvain Thénault
Tue, 10 Jun 2003 15:18:39 +0200


On Tuesday 10 June à 14:12, Chris Withers wrote:
> Sylvain Thénault wrote:
> >hello !
> >
> >Almost everything is in the subject: i would like to access to a portal
> >tool in the __setstate__ method for an object,
> 
> I can almost 100% garuantee you that you shouldn't be implementing 
> __setstate__.
> 
> What are you trying to do?

do you mean that __setstate__ should never be overriden or that I must
do something wrong that could be done in another way ?

I used __setstate__ to build a non persistent attribute from some
persistent data in my object. 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.

regards
-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org