[Zope] testing for property
Dieter Maurer
dieter@handshake.de
Fri, 28 Sep 2001 00:40:08 +0200 (CEST)
Tom Cameron writes:
> I am trying to write a script that upgrades instances of a class. I have
> added new properties to my python product Class and I wish to run a method
> to check the old instances and add properties if necessary.
Why would you want to do that?
Normally, you have a default in your class.
Only when the instance changes the property value, it will
get its own copy of the property.
> I find that when I use the hasProperty('propname') method it always returns
> true.
Use "self.__dict__.has_key('propname')".
Will work only in External Methods or other file system
Python code....
Dieter