[Zope] Updating Python products and their instances

Chris Withers chrisw@nipltd.com
Wed, 13 Jun 2001 10:46:59 +0100


Max Møller Rasmussen wrote:
> 
> > From: Andy [mailto:andy@agmweb.ca]
> 
> > We separate dev staging and production totally by having
> > totally different
> > Zopes, only putting new versions live once tested (in theory :).
> 
> Well yes ... I do that too. But often I have a product up and running, and I
> have to make an updated product that is incompatible with the old one. What
> I wondered about is how to upgrade from version 1.0 to 1.1 of the same
> products as easy as possible.

Here's what I do:

1. Write a one-shot updater external method. I use my UpdateSupport product to
help. If you have a look at http://www.zope.org/Members/chrisw/UpdateSupport/,
and you'll see three example ones there. There's also loads of examples in
Squishdot, I've been using this method for quite a while now :-)

2. Take down the Zope server and bring it up on another port, with the new
version of the Product installed.

3. run the updater

4. take the server down and bring it back up on its usual port.

The __setstate__ method Dieter suggested is very fragile and results in a
__setstate__ method with lots of nasty old code hanging around in it that you
can never get rid of in case someone decides to use your new code on a really
old version.

hope this helps,

Chris