- t = Template(file='list.tmpl', searchList=[d])
- js = fields.getfirst('js')
- if not js:
- return t
- if js == 'machinelist':
- return t.machineList(d['machines'])
- elif js.startswith('machinerow-'):
- request_machine_id = int(js.split('-')[1])
- m = [x for x in d['machines'] if x.id == request_machine_id]
- return t.machineRow(m)
- elif js == 'createtable':
- return t.createTable()