Rendering of list/table data with a template
Florian Lindner <[email protected]>
| Newsgroups | gmane.comp.python.twisted.web |
|---|---|
| Message-ID | <6475308.5poGRfLPQQ@horus> |
Hello,
I'm still trying to figure out what is the correct way to render data in a
template that comes from a list, e.g. to produce a table.
I have figured out a way, but I got no idea if that's the way to go:
<table>
<tr t:render="table_row"><td><t:slot name="table_content" /></td></tr>
</table>
with that renderer:
@renderer
def table_row(self, request, tag):
rows = ["A", "B", "C"]
output_list = []
for row in rows:
t = tag.clone()
t.fillSlots(table_content=row)
output_list.append(t)
return output_list
Is that how it should be done in twisted templating?
Thanks,
Florian