[Zope] Problems with zclass and instances!!

Dieter Maurer dieter@handshake.de
Sat, 4 Aug 2001 02:43:16 +0200 (CEST)


Edgardo Zulian writes:
 > ... Z Instance property no longer follows Z Class default value,
 > after it has been written once, even if written with the
 > former "default" value ...
 > ... how to detect, whether overwritten? ....
You can not do it in DTML or Python Script or other TTW contexts.

In an External Method (or other non-TTW contexts), you
can use:

    instance.__dict__.has_key('property_name')

If this expression returns a true value, then your "instance"'s
property value has been written and will no longer follow
a change in the class's default value.

You can then use:

    del instance.property_name

to revert to the previous state (inheriting the default)



Dieter