[Zope] How do I access an item in a list from dtml?

Gustin Kiffney gustin_kiffney@fd.org
Wed, 13 Oct 1999 14:21:36 -0400


I've read everything three times, searched the egroups index, and can't
find the answer to this simple question.  Unfortunately it seems to be a
namespace question and it's hard to phrase the question in a searchable way.

If I have passed a variable of type list to a method - in this case, it's 
a mailhost method - how do I access an item of that list?

Example: I'm passing the following:
parms=['item1','item2','item3']
and the Pythonic way to access an item of this list would be simply
parms[0] 
or 
parms[1]
etc.

But when I try <dtml-var parms[0]>
I get a KeyError for parms[0].
Doing <dtml-var parms> shows the list all right.  I can interate over the list
with 
<dtml-in parms>
all right also.  But I need to get particular items of the list and cannot
figure out how to do that.

I tried <dtml-var "_getitem(parms[0],0)"> as hinted at by a howto, but that just
gives me a 'slice error;

I can't find the magic '_.'?!" set of punctuation marks that will let me simply
access list items by index number!