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?

Reply via email to