[Zope] Anything like python's "dir" command for Zope?

Joel joel@lava.net
Sat, 1 Jun 2002 16:32:03 -1000


Hi,

One of the things I love most about Python is the ability to quickly dril=
l=20
down into any object, to see what attributes it has, what functions it ca=
n=20
call, and so on. (see below for a demonstration of what I'm talking about=
=2E)

I am now learning to use Zope, and am becoming increasingly frustrated tr=
ying=20
to figure out what various things provide. For instance,

container.objectIds() shows a list of everything in the root directory...
container.portal_url() shows the base url...

=2E.. and I'm sure that there are a dozen (or a hundred) other things tha=
t I can=20
do with a container object. How do I find them?

dir(container) doesn't work. It looks to me like the dir command doesn't =
work=20
under Zope, probably for security reasons. Does Zope have anything analag=
ous?=20
If not, how *do* you find out what any given object can do?

--Joel


$ python
Python 2.2 (#1, Feb 24 2002, 16:21:58)
[GCC 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)] on linux-i386
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> print string
<module 'string' from '/usr/lib/python2.2/string.pyc'>
>>> dir(string)
['_StringType', '__builtins__', '__doc__', '__file__', '__name__', '_floa=
t',=20
'_idmap', '_idmapL', '_int', '_long', 'ascii_letters', 'ascii_lowercase',=
=20
'ascii_uppercase', 'atof', 'atof_error', 'atoi', 'atoi_error', 'atol',=20
'atol_error', 'capitalize', 'capwords', 'center', 'count', 'digits',=20
'expandtabs', 'find', 'hexdigits', 'index', 'index_error', 'join',=20
'joinfields', 'letters', 'ljust', 'lower', 'lowercase', 'lstrip',=20
'maketrans', 'octdigits', 'printable', 'punctuation', 'replace', 'rfind',=
=20
'rindex', 'rjust', 'rstrip', 'split', 'splitfields', 'strip', 'swapcase',=
=20
'translate', 'upper', 'uppercase', 'whitespace', 'zfill']
>>> dir (string.zfill)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__get__'=
,=20
'__getattribute__', '__hash__', '__init__', '__name__', '__new__',=20
'__reduce__', '__repr__', '__setattr__', '__str__', 'func_closure',=20
'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals',=20
'func_name']
>>> string.zfill.__doc__
'zfill(x, width) -> string\n\n    Pad a numeric string x with zeros on th=
e=20
left, to fill a field\n    of the specified width.  The string x is never=
=20
truncated.\n\n    '