[Zope] testing for property
Tom Cameron
tom@mooball.com
Thu, 27 Sep 2001 09:56:55 +1000
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.
I find that when I use the hasProperty('propname') method it always returns
true.
It appears that this method checks the 'Class' and not the actual
'Instances' for the existance of a property. So if I upgrade my class, I
cant use this method to check for instances that are missing properties.
Is this true??
It appears I have to actually raise an error to check for a property
try:
print instance.property
else:
instance.property=''
This seems a bit silly. Am I doing anything wrong here
Tom