Discussion:
List of Dictionaries with Genshi
Enrico Heller
2013-10-21 12:01:39 UTC
Permalink
Hello there,

I'm new to genshi and want to output my own trac plugin with genshi. I have
a list of dicionaries and i want to output this
by key

[0]
+ {id} 01
+ {name} hans
[1]
+ {id} 02
+ {name} claudia

and so on...

now i want to output these like this way.

18 <table>
19 <th>ID</th><th>Name</th>
20 <py:for each="row in results">
21 <tr>
22 <td>$row['id']</td>
23 <td>$row['name']</td>
24 </tr>
25 </py:for>
26 </table>

the syntax in line 22 and 23 is wrong but i can't find some exambles.
How I do it right

Thanks for your Help
Enrico
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Simon Cross
2013-10-21 12:11:35 UTC
Permalink
Hi Enrico

See http://genshi.edgewall.org/wiki/Documentation/templates.html#synopsis.
You need to use something like:

<td>${row['id']}</td>

or

<td>${row.id}</td>

Schiavo
Simon
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Felix Schwarz
2013-10-21 12:08:01 UTC
Permalink
Post by Enrico Heller
22 <td>$row['id']</td>
23 <td>$row['name']</td>
try ${row['id']} or the Genshi shortcut ${row.id}

fs
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Enrico Heller
2013-10-22 06:38:09 UTC
Permalink
Hi there,

thanks for answers, i tryed a lil and found two solution that works for me.
:)

28 <table>
29 <th>ID</th><th>Name</th><th>Vorname</th>
30 <tr py:for="i in range(0,
len(results2))">
31 <td>${results2[i].id}</td>
32 <td>${results2[i].vorname}</td>
33 <td>${results2[i].name}</td>
34 </tr>
35 </table>


36 <table>
37 <th>ID</th><th>Name</th><th>Vorname</th>
38 <py:for each="row in results2">
39 <tr>
40 <td>${row.id}</td>
41 <td>${row.vorname}</td>
42 <td>${row.name}</td>
43 </tr>
44 </py:for>
45 </table>

Greetings
Enrico
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...