[Zope] Returning lists of tuples

James W. Howe jwh@allencreek.com
Mon, 28 Feb 2000 14:52:45 -0500


At 01:25 PM 2/28/00 -0600, Evan Simpson wrote:
>----- Original Message -----
>From: James W. Howe <jwh@allencreek.com>
> > <dtml-return "[('Go Here', 'foo.bar.com') , ('Go Somewhere Else',
> > 'baz.foo.com')]">
> >
> > I would like to do something like this with this result:
> >
> > <dtml-in urltags>
> > <a href="< url part from tuple >">< display part of tuple ></a>
> > </dtml-in>
>
>dtml-in has a special case for lists of two-tuples like this.  It makes the
>first element of each tuple 'sequence-key' and the second 'sequence-item'.
>Try...
>
><a href="&dtml-sequence-item;">&dtml-sequence-key;</a>

I tried that very thing and was surprised that it worked.  The reason I was 
surprised was because I would have expected sequence-item to have answered 
the tuple object itself, rather than just the "value" component.  It would 
seem that sequence-item should always answer the item itself, and there 
should be two special variables, sequence-key and sequence-value which 
answer the key and value respectively if the sequence-item happens to be a 
tuple or mapping.

Anyway, thanks for the info.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103