| 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 | |
|---|
| 6 | And 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 | |
|---|
| 14 | content = response._vars[next(iter(response._vars))] |
|---|
| 15 | response.headers['Content-Type'] = 'application/vnd.ms-excel' |
|---|
| 16 | response.write(str(content), escape=False) |
|---|
| 17 | }}{{pass}} |
|---|
Note: See
TracBrowser
for help on using the repository browser.