Maybe try writing the content to a StringIO object and using
response.stream (see http://web2py.com/books/default/chapter/29/4#response).
Anthony
On Thursday, December 22, 2011 10:09:04 PM UTC-5, thstart wrote:
>
> I want the visitors to be able to download a CSV file.
>
> here is my code:
> def download():
> response.headers['Content-Type'] = 'text/csv'
> attachment = 'attachment;filename=' + file+ '.csv'
> response.headers['Content-Disposition'] = attachment
>
> content = '....,....,....'
> raise HTTP(200,str(content),
> **{'Content-Type':'text/csv',
> 'Content-Disposition':attachment + ';'})
>
> When I click on the link download, I get 'Undefined' in the browser
> and nothing is downloaded.
>
> What is wrong?
>
>