Hello, I try to access a folder property from within a product. But I have no clue what my python code should look like? I have my manage_test function called from the web, but how can I test if a property is available (in one of the parents)? Thanks Ulli
Ulrich Wisser wrote:
Hello,
I try to access a folder property from within a product. But I have no clue what my python code should look like? I have my manage_test function called from the web, but how can I test if a property is available (in one of the parents)?
hi, you could use something like: if hasattr(self, 'propertyid'): ... property exists in one of the parents... Cheers, Maik -- German Zope User Group http://www.dzug.org/
Maik Jablonski wrote:
you could use something like:
if hasattr(self, 'propertyid'): ... property exists in one of the parents...
hmmm, this is probably betterL if self.hasProperty('propertyid'): ...property exists on self cheers, Chris
Chris Withers wrote:
Maik Jablonski wrote:
you could use something like:
if hasattr(self, 'propertyid'): ... property exists in one of the parents...
hmmm, this is probably betterL
if self.hasProperty('propertyid'): ...property exists on self
Hi Chris, I don't think your proposal is a solution for the problem... hasProperty doesn't use acquisition, so you check only the current object for a property. The original poster wanted to check if a property was set in an aquired folder... sure, he can't rely on that hasattr(self,'propertyid') is a property [=> can be any aquired object]. Cheers, Maik -- German Zope User Group http://www.dzug.org
Maik Jablonski wrote:
I don't think your proposal is a solution for the problem... hasProperty doesn't use acquisition, so you check only the current object for a property. The original poster wanted to check if a property was set in an aquired folder... sure, he can't rely on that hasattr(self,'propertyid') is a property [=> can be any aquired object].
Apologies, that was me misreading. Your way is the way to go then :-) cheers, Chris
participants (3)
-
Chris Withers -
Maik Jablonski -
Ulrich Wisser