|
Last change
on this file since 17841 was
4525,
checked in by Henrik Bettermann, 17 years ago
|
|
provide link for download import file
|
|
File size:
870 bytes
|
| Line | |
|---|
| 1 | ## Script (Python) "download_data" |
|---|
| 2 | ##bind container=container |
|---|
| 3 | ##bind context=context |
|---|
| 4 | ##bind namespace= |
|---|
| 5 | ##bind script=script |
|---|
| 6 | ##bind subpath=traverse_subpath |
|---|
| 7 | ##parameters= |
|---|
| 8 | ##title= |
|---|
| 9 | ## |
|---|
| 10 | # $Id: download_pending.py 3325 2008-03-12 14:06:44Z joachim $ |
|---|
| 11 | """ |
|---|
| 12 | export xxx.csv |
|---|
| 13 | """ |
|---|
| 14 | request = context.REQUEST |
|---|
| 15 | setheader = request.RESPONSE.setHeader |
|---|
| 16 | |
|---|
| 17 | name,data = context.getContent()['getData']() |
|---|
| 18 | |
|---|
| 19 | #setheader('Content-type', 'text/x-cvs') |
|---|
| 20 | #setheader('Content-type','application/vnd.ms-excel') |
|---|
| 21 | setheader('Content-type','text/semicolon-seperated-values') |
|---|
| 22 | setheader('Content-Disposition:', 'attachment; filename="%s.csv"' % name) |
|---|
| 23 | setheader('Expires', 'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past |
|---|
| 24 | setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1 |
|---|
| 25 | setheader('Cache-Control', 'post-check=0,pre-check=0') |
|---|
| 26 | #setheader('Pragma', 'no-cache') # HTTP/1.0 |
|---|
| 27 | return data |
|---|
Note: See
TracBrowser for help on using the repository browser.