[Twisted-web] Rendering of list/table data with a template
Florian Lindner
mailinglists at xgm.de
Tue Aug 23 08:34:09 EDT 2011
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
More information about the Twisted-web
mailing list