[Zope] Anything like python's "dir" command for Zope?
Dennis Allison
allison@sumeru.stanford.EDU
Sat, 1 Jun 2002 19:47:41 -0700 (PDT)
Joel--
You will want to get and use a copy of Dieter Maurer's DocFinder product
that helps take some of the complexity out of the Zope namespaces.
http://www.handshake.de/~dieter/pyprojects/zope/
On Sat, 1 Jun 2002, Joel wrote:
> Hi,
>
> One of the things I love most about Python is the ability to quickly drill
> down into any object, to see what attributes it has, what functions it can
> call, and so on. (see below for a demonstration of what I'm talking about.)
>
> I am now learning to use Zope, and am becoming increasingly frustrated trying
> 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...
>
> ... and I'm sure that there are a dozen (or a hundred) other things that I can
> 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
> under Zope, probably for security reasons. Does Zope have anything analagous?
> 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__', '_float',
> '_idmap', '_idmapL', '_int', '_long', 'ascii_letters', 'ascii_lowercase',
> 'ascii_uppercase', 'atof', 'atof_error', 'atoi', 'atoi_error', 'atol',
> 'atol_error', 'capitalize', 'capwords', 'center', 'count', 'digits',
> 'expandtabs', 'find', 'hexdigits', 'index', 'index_error', 'join',
> 'joinfields', 'letters', 'ljust', 'lower', 'lowercase', 'lstrip',
> 'maketrans', 'octdigits', 'printable', 'punctuation', 'replace', 'rfind',
> 'rindex', 'rjust', 'rstrip', 'split', 'splitfields', 'strip', 'swapcase',
> 'translate', 'upper', 'uppercase', 'whitespace', 'zfill']
> >>> dir (string.zfill)
> ['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__get__',
> '__getattribute__', '__hash__', '__init__', '__name__', '__new__',
> '__reduce__', '__repr__', '__setattr__', '__str__', 'func_closure',
> 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals',
> 'func_name']
> >>> string.zfill.__doc__
> 'zfill(x, width) -> string\n\n Pad a numeric string x with zeros on the
> left, to fill a field\n of the specified width. The string x is never
> truncated.\n\n '
>
>
>
>
> _______________________________________________
> 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 )
>