On Monday, November 14, 2016 at 1:35:01 PM UTC-8, lucas wrote:
>
> how about simpler?
>
>                 from StringIO import StringIO
>                 stream = StringIO("test for echo")
>                 stream.write("oh crap")
>                 stream.seek(0)
>                 response.headers['Content-Type'] = 'text/plain; 
> charset=us-ascii'
>                 response.headers['Content-disposition'] = 'attachment; 
> filename=hsDNA_%s_IQa.py' % (qry[0][1])
>                 return response.write(stream.getvalue())
>
> but it only puts the string "None" in the downloaded file.  i've tried it 
> with cStringIO instead of StringIO, with and without the write method.  i 
> just can't get those strings to come across.
>
> but if i replace the last line with "return HTML(BODY(stream.getvalue()))" 
> it will work.  so for some reason the stream is filling with the strings 
> but the stream is not filling the file.
>

leave off the response.write() around the stream.getvalue().
 
/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to