On Friday, December 21, 2012 2:49:37 PM UTC-5, kk.gnu wrote:
>
> Hello all. 
> I wish to send across an ods (spreadsheet) file from my pylons 
> controller in such a way that the browser should ask the user to 
> download the file (by presenting the usual download dialog of course ). 
> Can some one help here? 
> happy hacking. 
> Krishnakant. 
>

Once you have the ods as a file object in your view-callable you can return 
it with something like:

filecontent = myfile.read()
headers = {
    'Content-Type': 'application/ods',
    'Content-Length': len(filecontent), 
    'Content-Disposition': 'attachment; filename=myfilename.ods' }
return Response(filecontent, headerlist=headers.items()) 


You will have to find out what the correct content-type is for ODS files 
though. 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/9kBARPCLhcMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to