[Zope] Returning lists from python back to dtml

Charlie Reiman creiman@kefta.com
Thu, 25 Jul 2002 09:59:42 -0700


You can use the mapping option for dtml-in, as several people have already
mentioned. But you should also look into using a brain to wrap your returned
objects. Depending on your needs, a brain may prove more useful (or not).

The Zope Book covers both options pretty well.

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Isokangas, Erik HTC/DE/FRA
> Sent: Thursday, July 25, 2002 6:58 AM
> To: 'zope@zope.org'
> Subject: [Zope] Returning lists from python back to dtml
>
>
> Hi,
>
> I must admit I'm relatively new to both python and Zope but have a problem
> which I can't find the solution to in the (easy-to-reach)
> documentation.  A
> lot has been written about passing data from dtml to python
> scripts, but not
> much in the other direction.
>
> I have no problems returning simple lists, e.g.
> # getResults
> return (1,2,3,4,5)
>
> ...where the results are returned to a dtml method using something like:
> <dtml-in "getResults()">
>    <dtml-var sequence-item>
>    </dtml-in>
>
> However, I wish to pass a table of results with 'column names'
> (in layman's
> terms), such that I can read the returned results something like...
> <dtml-in "getResults()">
>    <dtml-var Column1> <dtml-var Column2> <dtml-var Column3>
>    </dtml-in>
>
> So, how do I pass named results from python script to dtml?
>
> Thanks for your thoughts.
>
> Erik.
>
>
> _______________________________________________
> 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 )
>