[Zope] ONLY in python script
Dieter Maurer
dieter@handshake.de
Mon, 23 Apr 2001 21:31:30 +0200 (CEST)
Peter Bengtsson writes:
> ... testing whether an object itself (not acquired) has an attribute ....
> No 'aq_explicit' doesn't work.
Make an external method: "hasattr_itself"
with the following content:
def hasattr_itself(object,attribute):
'''return true iff *object* itself has attribute *attribute*.'''
base= getattr(object,'aq_base',object)
return hasattr(base,attribute)
Put a feature request into the Collector.
Zope should provide such a function as a built-in.
Dieter