[Zope] frustrated by inability to introspect...
Chris McDonough
chrism@zope.com
26 Oct 2002 01:02:06 -0400
In this case, "item" is user-defined. For each iteration, it's whatever
kind of object is in the sequence that is returned from
"container/enumerate_lists". By your description, in this case, all
elements in this sequence will be ZSQL "brain" objects. These objects
are really just simple wrappers that you can call getitem on with column
names and get back something reasonable. Their class is defined in
lib/python/Shared/DC/ZRDB/Results.py and is named "Results".
You may be interested in this, however if you want to just bust down
into a Python prompt and call methods and whatnot:
http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
http://www.zope.org/Members/mcdonc/HowTos/UsingTheZopeDebugger
HTH,
- C
On Fri, 2002-10-25 at 23:54, Skip Montanaro wrote:
>
> I have the following little snippet of pt code:
>
> <form action="edit_list">
> <select name="listname">
> <option tal:repeat="item container/enumerate_lists"
> tal:content="item">list</option>
> </select>
> <input type="submit" value="Edit">
> </form>
>
> container/enumerate_lists is a ZSQL method that performs a simple query:
>
> select listname from mailinglists
>
> All I want to do is display the listnames as form option values. I can't
> figure out what attributes "item" has. The dir() builtin isn't exposed as
> far as I can tell. I've been wandering all over the Zope Book for about 20
> minutes and have so far been unable to find the attributes associated with
> the "item" object. Where should I be looking? Is there a rough Zope
> equivalent to
>
> >>> dir("abc")
> ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
> '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__',
> '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__',
> '__mul__', '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__',
> '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode',
> 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum',
> 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper',
> 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex',
> 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip',
> 'swapcase', 'title', 'translate', 'upper', 'zfill']
>
> or
>
> >>> print "".capitalize.__doc__
> S.capitalize() -> string
>
> Return a copy of the string S with only its first character
> capitalized.
>
> ?
>
> Thx,
>
> --
> Skip Montanaro - skip@pobox.com
> http://www.mojam.com/
> http://www.musi-cal.com/
>
> _______________________________________________
> 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 )