[Zope] Python products - Versions in Zope

Dieter Maurer dieter@handshake.de
Tue, 12 Jun 2001 22:08:55 +0200 (CEST)


=?iso-8859-1?Q?Max=5FM=F8ller=5FRasmussen?= writes:
 > > 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.
The main problem should be members the new objects have while
the old do not.

There are two approaches, I know of:

 1. define class variables as defaults for these new members

    class C: # new product
      new_member= None

      def method(self):
        if self.new_member is None:
	  # may need to do something
	...


 2. instantiate the new instance variables in the "__getstate__" method.


I expect a HowTo on zope.org for these questions.


Dieter