[Zope3-dev] Re: [Zope] Zope (X)3 FAQ

Chris Withers chrisw@nipltd.com
Tue, 22 Apr 2003 14:04:45 +0100


Steve Alexander wrote:
> 
>> How do you ensure that the object hasn't already had this __setstate__ 
>> modification done on it?
> 
> You look at its state, then decide based on the state.
> Or, you make the upgrade process idempotent.

What happens when the different if-then-else things build up over time?

>> What are the performance implications of using __setstate__ in this way?
> 
> It usually works pretty well.

I'm not questioning how well it works, I'm wondering what the performance 
implications are...

cheers,

Chris

PS: FWIW, I've always prefered run-once upgrade scripts to fix things like this 
(see Squishdot's updaters). You don't end up with complex __setstate__ methods 
and you can correct the results of previous bugs in the process...