[Zope] How to Build a List ?

Evan Simpson evan@4-am.com
Fri, 29 Oct 1999 05:22:11 +0000


"Kulpinski, Dejan" wrote:

> Does anybody know how to build a list using set (or any other) command ?
> I would like to read stuff from database and store it in a list using just
> Zope and without building long string and then parsing it using split
> command...

<dtml-call "REQUEST.set('myvar', [])">
...
<dtml-call "myvar.append(v)">

You can also use dtml-let or dtml-with "_(myvar=[])" to get the list started,
and standard list methods like extend and insert to build it.

How are you getting your data, though?  If it's from a SQL DA, then the
entire dataset comes already nicely packaged in an object which you can treat
as a list of lists.

Evan