[Zope] update existing instances of a class?

John Schinnerer johnschinnerer at yahoo.com
Sat Sep 11 21:06:55 EDT 2004


Aloha,

>If you change the definition of the class to have 
> new attributes, every instances of that class will have these 
> attributes, too.

Instances created *after* I add properties do, of course.
Instances created *before* I added the properties do not...or if they
do, an attribute error is generated anyway.

For example:
I have updated my python product code by adding properties to a class.
I have refreshed the product via the ZMI.
If I then go to an instance of the class created *before* the property
additions and refresh, and click on the Properties tab, I get an
attribute error.
The error is generated in PropertyManager.py, on a call to getProperty.
The error value is the name of the first property that is *not* present
in the "old" instance of the class (any instance created before adding
properties to the product and refreshing).

So it doesn't appear to me that "old" instances automagically get the
new properties, since they generate an attribute error when trying to
access the first of the new properties.

That is my question - is there any way to 'touch' the old instances so
that they get the new properties?

Or do they all have to be re-created and re-populated?

Or am I totally mis-understanding everyone's answers thus far?

thanks,
John S.


		
_______________________________
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool


More information about the Zope mailing list