[Zope] Iterating through object properties

Kevin Carlson khcarlso@bellsouth.net
Tue, 27 Aug 2002 09:41:55 -0400


It looks like the "dir" function will do what I need it to do, but I'm
curious about something:  I can't seem to call this function inside a Python
script.  Do I have to use an external method for this function?  If so, why?
It's a python built-in and other built-in functions allow calling from
python scripts...

Thanks,

Kevin

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Max M
Sent: Monday, August 26, 2002 4:19 PM
To: Kevin Carlson
Cc: zope@zope.org
Subject: Re: [Zope] Iterating through object properties


Kevin Carlson wrote:

>Thanks, Andreas.  This works great for properties that are defined in Zope.
>Is there a way to do this same thing for properties that are defined in a
>python product?  For example, calling propertyItems on a CMFEvent displays
>the title of the event, but does not display the start_date and end_date
>properties that are defined in the python source for the CMF type.
>
>
Perhaps you can use the dir() function to get a list of attributes.
Something like:

attributes = [attr for attr in dir(obj.aq_base) if not
callable(getattr(obj.aq_base, attr))]



regards Max M

    "klaatu verata niktu"




_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )