[Zope] Re: Upgrading Zope Products

Tres Seaver tseaver at zope.com
Thu Mar 24 13:02:47 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian Brinegar wrote:

| Is there a best practice for making changes to a Zope Product?
| Specifically I've written a product based off of ZCatalog. In the
| newest version I have added a few things to the _properties and a new
| index.
|
| I've found that instances of my product that have not made changes to
|  the default properties pick up the new _properties. However if
| someone had previously added a property or changed the default values
| the new _properties do not show up.
|
| I was thinking it may be best to have an upgrade method that can
| bring any instance up to date by adding properties, etc. Is there a
| standard way for doing this? Any experiences on one way being better
| than another?
|
| FYI, We've got about a 40 gig ZODB and searching all of it to find
| objects to upgrade is about impossible.


You can set default values on the object's class which will be picked
up.  E.g.,

~  # old version
~  class Foo(SimpleItem):
~      """ Foo objects.
~      """
~  bar = 0
~  baz = ''
~  _properties = ({'id': 'bar', 'type': 'int', 'mode': 'w'},
~                 {'id': 'baz', 'type': 'string', 'mode': 'w'},
~                )

~  # updated version
~  class Foo(SimpleItem):
~      """ Foo objects.
~      """
~  bar = 0
~  baz = ''
~  qux = ()
~  _properties = ({'id': 'bar', 'type': 'int', 'mode': 'w'},
~                 {'id': 'baz', 'type': 'string', 'mode': 'w'},
~                 {'id': 'qux', 'type': 'tokens', 'mode': 'w'},
~                )


Tres.
- --
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCQwDHGqWXf00rNCgRAqtuAJ9eu45rhwA6YdhybbjlR2lZTtIo9gCfbEIU
ady8TAI2fNCM4ApuH6+YeJI=
=7Jo1
-----END PGP SIGNATURE-----



More information about the Zope mailing list