[Zope] Re: How do I update objects?

Maik Jablonski maik.jablonski@uni-bielefeld.de
Mon, 17 Feb 2003 12:49:34 +0100


Oliver Marx wrote:
> Dear list
> 
> I have a product which I want to extend.
> I want to add a property.
> 
> In my ZODB I all ready have ~1000 objects stored. And I would hate if I 
> have to add them again.
> 
> Is there a way to update the existing objects?

Simply add the new property to your global class defintion and to the 
PropertySheet-defintion:

class YourObjectClass(SimpleItem, PropertyManager):
     """ A class to build ... """

     newProperty = ''

     _properties = ({'id': 'title', 'type': 'string', 'mode': 'w'},
                    {'id': 'newProperty', 'type': 'string', 'mode':'w'},)


Zope will update your existing objects at startup this way.

Cheers, Maik