methods and vars in zope objects

Dave Benjamin ramen at lackingtalent.com
Thu Apr 24 12:27:19 EDT 2003


In article <c42e062e.0304211805.4ced1175 at posting.google.com>,
Erik Lechak wrote:
> Is there a simple script, document, manual, or button that will list
> the methods and member vars available to a certain object?  Something
> like dir().

How about "dir()"? =)

Try this:
 1. Create a file in your Extensions directory called "dir.py".
 2. In this file, write the single line:
    dir_ = lambda x: dir(x)
 3. Create an External Method:
    id: dir
    module: dir
    function: dir_
 4. Use context.dir(obj) from your PythonScript.

In general, this technique works for exposing Python library functions to
the Zope environment. Mind the associated security risks, of course.

Peace,
Dave




More information about the Python-list mailing list