[Zope-CMF] Add attributes to class which already has instances
in ZODB
Raphael Ritz
r.ritz@biologie.hu-berlin.de
Thu, 09 Jan 2003 12:08:26 +0100
Hi Rainer,
Look at the product development chapter in the developers guide
http://www.zope.org/Documentation/Books/ZDG/current/Products.stx
There is a section on "evolving classes". The statements there also
hold for CMF products.
You can even use monkey patching
(http://www.zope.org/Members/Caseman/Dynamic_Hotfix,
there is also a German translation on http://www.dzug.org which
I wrote recently)
to provide the new attribute, its class default and any methods
related to them.
HTH
Raphael
Rainer Thaden wrote:
>Hi,
>
>let's say you've written a type-class for CMF with some attributes,
>but you are not sure, if there are attributes missing. When you notice
>that there are missing attributes it will be too late to change the
>class, because there are already some instances in the ZODB, which you
>can't assign the new attributes.
>What would you do to prevent this situation when developing the class?
>Is it possible to add some dummy attributes and assign them the
>appropriate name afterwards like
>
>Attribute list:
> name='' #'normal' attributes
> birth=''
> ext1='' #dummy attributes
> ext2=''
>
> and then you notice that you need an attribute for an email and
> write
>
> email=ext1
>
> inside the class.
>
>Will a call to email on the objects which are already in the ZODB
>resolve the right name?
>
>
>