[Zope-dev] Returning values for dtml-in

Jonothan Farr jfarr@real.com
Tue, 28 Mar 2000 16:31:16 -0800


> What kind of result do I need to return from a python method in order
> for the return value to be usable by <dtml-in> ?
>
> In other words, I want to do:
>
> def blah(self):
>     l = [{val : 'blah1'}]
>     return l

Here's one way to do it. There may be others:

<dtml-in blah mapping>
<dtml-var _['sequence-item']['val']>
</dtml-in>

The 'mapping' parameter to dtml-in causes it to treat the sequence items as
mappings instead of instances. Then "_['sequence-item']" refers to the
dictionary object and "_['sequence-item']['val']" refers to the 'val' element of
that dictionary.

-jfarr