get non-acquired attributes of an instance
hello, is it possible to get the list of all an object's attributes, excepted the ones acquired from parents ? thanks -- Thomas Desvenain Junior Plone/Zope analyst-developer, Looking for a Job ! Now, trainee at Institut National de Recherche Agronomique Mathématiques, Informatique et Génôme laboratory 78350 Jouy en Josas +33 (0)1 34 65 29 43
--On 26. Juni 2006 10:30:50 +0200 thomas desvenain <thomas.desvenain@gmail.com> wrote:
hello,
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__ ? -aj
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
participants (3)
-
Andreas Jung -
Dieter Maurer -
thomas desvenain