[Zope] Creating properties in python products
Dieter Maurer
dieter@handshake.de
Wed, 22 Aug 2001 23:08:41 +0200 (CEST)
Georges Baladi writes:
> I have developed some custom products in python and this products has =
their own=20
> properties. Later I need to creat new basic properties. The objects wi=
th only=20
> the initial basic properties acquire the new properties but objects th=
a has=20
> other properties (created in the management interface) don=B4t. And be=
cause in=20
> this objects the other properties has the same name that the new basic=
=20
> properties ever if I delete the other properties I can=B4t create (in =
the=20
> management interface) an propertie with the same name tha the properti=
e defined=20
> in the python product (but no propertie with this name are show in the=
=20
> management interface). I am using Zope 2.3.3.
This is as one would expect...
The class contains a "_properties" describing the default
properties. This is a tuple.
When an instance changes its properties, modification
are done on a local copy (and, of course, not in the
class's "_properties"). From then on, the linkage
between class properties and instance properties is
broken - as you described.
You can use "PropertySheets" instead of "_properties".
They are (a bit) more versatile but you may still
experience surprises....
Dieter