source: tmcsimulator/branches/LCSv1/views/generic.csv @ 593

Revision 593, 704 bytes checked in by jdalbey, 6 years ago (diff)

Add branch LCSv1

Line 
1{{"""Usage:
2
3  def controller():
4      return {"": db().select(db.thing.ALL)}
5
6And then visit that controller with a .csv extention name
7"""
8}}{{if len(response._vars)==1:}}{{
9# Not yet find a Python 2/3 compatible StringIO pattern,
10# we avoid this solution http://web2py.com/books/default/chapter/29/10/services#CSV
11# Here we buffer the entire csv file instead (it is your controller's job to limit the volume anyway),
12# based on: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-one-Table-at-a-time-
13
14content = response._vars[next(iter(response._vars))]
15response.headers['Content-Type'] = 'application/vnd.ms-excel'
16response.write(str(content), escape=False)
17}}{{pass}}
Note: See TracBrowser for help on using the repository browser.