Hi all I've created a Python Script like class with Catalogawarness and PropertyManager as super classes too My problems begins when I try to know if these objects has some properties. If I try these: hasattr(object.aq_explicit, 'someproperty') the function returns false but when I go to ZMI to object's properties form I could see the property someproperty Can you help me? Thank a lot!!!
Garito wrote:
Hi all
I've created a Python Script like class with Catalogawarness and PropertyManager as super classes too
My problems begins when I try to know if these objects has some properties. If I try these:
hasattr(object.aq_explicit, 'someproperty')
Why do you try to get 'someproperty' from acquisition? Don't you want to check for 'someproperty' in object? Hence: hasattr(object, 'someproperty') -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
Thanks for your response Johan Alexis Roda points me to the correct solution I use object.hasProperty('someproperty') Cheers -----Original Message----- From: Johan Carlsson <johanc@easypublisher.com> To: Garito <garito@sistes.net>, zope@zope.org Date: Tue, 14 Sep 2004 21:09:24 +0200 Subject: Re: [Zope] hasattr
Garito wrote:
Hi all
I've created a Python Script like class with Catalogawarness and PropertyManager as super classes too
My problems begins when I try to know if these objects has some properties. If I try these:
hasattr(object.aq_explicit, 'someproperty')
Why do you try to get 'someproperty' from acquisition?
Don't you want to check for 'someproperty' in object?
Hence: hasattr(object, 'someproperty')
-- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
Garito wrote at 2004-9-14 17:44 +0200:
... My problems begins when I try to know if these objects has some properties. If I try these:
hasattr(object.aq_explicit, 'someproperty')
the function returns false but when I go to ZMI to object's properties form I could see the property someproperty
I cannot believe this! The objects must be different. -- Dieter
participants (3)
-
Dieter Maurer -
Garito -
Johan Carlsson