[Zope] Re: Upgrading Zope Products

Brian Brinegar brinegar at purdue.edu
Thu Mar 24 14:22:59 EST 2005


> If you are adding properties manually through the ZMI, then they will no
> longer use the '_properties' map defined by the product -- they *will*,
> however, have the actual attribute defined via the class (this is how
> Python's attribute lookup works).

I understand this, it sounds like my best option is to compare the
instances _properties map with that defined by the class adding things
when necessary. It would be nice if there was a standard method that
Zope called upon accessing an object that could be responsible for
making these changes.

> | Also, this does not address adding a new index which is set normally
> | set during the __init__ method.
> 
> I don't know what 'index' is, but the only backwardly-compatible way to
> add such an attribute is to define a "default" at class scope (e.g.,
> 'index = None'), and then check for that default value whenever you need
> to use it, and instantiate the "real" value at that point.  I usually
> use an accessor method for such purposes.

I had mentioned earlier that this was based off of ZCatalog, I'm
refering to a ZCatalog Index. Initially the __init__ method of my
product would add several indexes to the catalog on creation, however in
the new version I want to add an additional index.

I've seen several solutions to this problem, one is to have an upgrade()
method that every method of your object calls first. Another is to run a
script that finds all instances and does the upgrade code. There doesn't
seem to be a standard/clean way of doing this.

-Brian


More information about the Zope mailing list