[Zope] New versions of a product

Jim Fulton jim@digicool.com
Tue, 27 Apr 1999 07:53:02 -0400


Robert Leftwich wrote:
> 
> What is the best strategy to use when upgrading to a new version of a Zope
> Product that is already in production and has significant amounts of data
> in it?
> 
> The issues are :
> 
> 1. Modified hierarchy of objects

I take this to mean that the data structures in the classes that
your product defines have changed.  There are two ways to deal with this:

  - Provide data conversion in __setstate__ methods

  - Create a new product

> 2. New classes/objects - not a problem as they don't exist in the earlier
> version.

Right.

> 3. Deleted classes/objects (i.e. no longer required)

If you have instances of these classes in the database, 
then you need to kwwp the classes around or the instances will 
be broken. OTOH, if the instances themselves are no longer
needed and if the instances were persistent, then
you can let them be broken.

> 4. Renamed classes/objects

You ned to define aliases:

  class NewName:
     ...

  OldName=NewName

If you've changed package names, you'll
have to define package aliases. See 
the ZSQLMethods __init__.

> 5. New methods/attributes -  not a problem as they don't exist in the
> earlier version.

Right, but the class should define default values for the
new attributes, or the methods need to work when the attributes 
are not present or __setstate__ needs to add them.

> 6. Deleted methods/attributes  (i.e. no longer required)

No problem.

> 7. Renamed methods/attributes

Then:

  - Code that uses them needs to work with old and new names,

  - __setstate__ has to convert old attributes, or

  - You might be able to create aliases using a computed
    attribute mechanism.

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (540) 371-6909              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.