Anything like python's "dir" command for Zope?
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 '
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 )
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',
[snip] it seems to me you are in the dark, but there is light: advanced: http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html more the howto style: http://www.zope.org/Members/michel/ZB especially the appendices read the source, eg. for Folder: ../lib/python/OFS/Folder.py, ../lib/python/OFS/ObjectManager.py container.objectIds() shows a list if object ids contained in container (root iff container is root) ------------------------------------------------------------- Who's got only a hammer sees the world as a nail hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299
participants (3)
-
Dennis Allison -
hans -
Joel