RE: [Zope] ONLY in python script
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
Dieter Maurer wrote:
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
Here is the patch as submitted to the collector. Enjoy: http://classic.zope.org:8080/Collector/2201/view -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (2)
-
Casey Duncan -
Dieter Maurer