[Zope-dev] getattr for non-Folderish item

Dieter Maurer dieter@handshake.de
Tue, 26 Jun 2001 05:40:34 +0200 (CEST)


Johnson, Michael (MIJOHNSO) writes:
 > ... "getattr" does not work for attributes of inherited ZClasses ...

"getattr" does no special things for folderish items.
It simply accesses the attributes of an object in case,
you can not use the attribute access syntax

    object.attribute

because either the attribute name does not follow Python name
syntax or is not constant.

Furthermore, it does not care, whether the attribute is
defined in the objects class itself or in an inherited class.

Thus, "getattr(self,your_attribute)" should work.
If not, something else is wrong (there is not attribute
with name given be "your_attribute").


Dieter