<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
David H wrote:
<blockquote cite="mid439FC66E.2080005@earthlink.net" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
Paul Winkler wrote:
  <blockquote cite="mid20051214065534.GA24672@slinkp.com" type="cite">
    <pre wrap="">On Wed, Dec 14, 2005 at 06:06:21PM +1300, Cameron Beattie wrote:
  </pre>
    <blockquote type="cite">
      <pre wrap="">I am trying to get my head around representing a list in a page template.

Assume the following list:
    </pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">m
          </pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre wrap="">[[61282125371L, 1, 6, 0], [61282125379L, 1, 6, 0], [61282825240L, 6, 6, 0], 
[61282125378L, 1, 6, 0], [61282125374L, 1, 6, 0]
    </pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">m[0]
          </pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre wrap="">[61282125371L, 1, 6, 0]
    </pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">m[0][0]
          </pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre wrap="">61282125371L

i.e. m is a list where each member is itself a list.

How do I get a page template to render a particular item? Assume a function 
getem returns the list.
&lt;tal:block repeat="m python:here.getem()"&gt;
   &lt;td tal:repeat="single m" tal:content="single"&gt;&lt;/td&gt;

This code will produce four columns and five rows, with each populated by 
the list members. But what if I only want the first and third members in 
each case i.e. 2 columns and five rows?

I thought it would be something like tal:content="python:single[0]" but 
that gives me an unsubscriptable object error.
    </pre>
    </blockquote>
    <pre wrap=""><!---->
That's because, in your example, each time through the loop,
single is an int. Try indexing m instead.

  </pre>
  </blockquote>
I think all thats needed is a tal:condition (he wants to filter out
rows)<br>
  <br>
1)&lt;span tal:define="res python: context.pyTest();"&nbsp;&nbsp; &lt;--- returns
list of lists&nbsp; like [[61282125371L, 1, 6, 0], [61282125379L, 1, 6, 0],
[61282825240L, 6, 6, 0]] &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; tal:repeat="r1 res"&gt;<br>
3) &nbsp;&nbsp; &lt;tal:span tal:repeat = "r2 r1" <br>
4) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tal:condition="python: repeat.r2.number in (1,2,4)" <br>
5) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tal:content="r2"&gt;<br>
6) &lt;/tal:span&gt;<br>
  <br>
Where 4 is not brain dead as in my example. <br>
  <br>
David<br>
  <br>
  <br>
  <br>
  <br>
  <br>
</blockquote>
Ok, its best to parse your list of lists in a python script.&nbsp; You pass
a tuple (or array) of inclusionary index numbers.&nbsp; It will return the
filtered list of lists&nbsp; The problem with the try I gave before is that
*condition* is evaluated before *repeat*&nbsp; :-0<br>
<br>
So ...<br>
<br>
# python script<br>
# input:&nbsp; a tuple named tup of index items to include in list of lists,
eg (1,3) and the list of lists<br>
#example input:&nbsp; listoflists = [[61282125371L, 1, 6, 0], [61282125379L,
1, 6, 0], [61282825240L, 6, 6, 0]]<br>
#example tup: (1,3)<br>
<br>
ret = []<br>
for i in range(len(listoflists)):<br>
&nbsp; if i in tup:<br>
&nbsp;&nbsp;&nbsp; ret.append(x[i])<br>
return ret<br>
<br>
Then your ZPT is easy.<br>
<br>
David<br>
<br>
</body>
</html>