[Zope] get non-acquired attributes of an instance

Dieter Maurer dieter at handshake.de
Mon Jun 26 14:14:22 EDT 2006


Andreas Jung wrote at 2006-6-26 10:35 +0200:
>...
>> is it possible to get the list of all an object's attributes, excepted
>> the ones acquired from parents ?
>>
>
>aq_base(aq_inner(obj)).__dict__ ?

This can be optimized to "obj.__dict__" (because attributes starting
with "_" are never acquired).

Be warned however, that "__dict__" might be shown empty.
This happens, when the object is not yet loaded from the ZODB.
Access "obj.<some_non_existinge_attribute>" and it will get loaded.

Note also that "__dict__" contains only the instance attrbutes
and neither acquired ones (what you want) nor those "inherited"
from the associated class.


-- 
Dieter


More information about the Zope mailing list