nope. you could want to stream something at the middle of the stringio 
constructed stream. Dealing with seek() is basic python 101.

On Monday, December 29, 2014 3:03:45 PM UTC+1, flagist0 wrote:
>
> Thank you! Yes, it worked, but maybe it should be added into the 
> response.stream code
>  itself?
>
> 2014-12-27 2:27 GMT+04:00 Niphlod <nip...@gmail.com <javascript:>>:
>
>> the docstrings api on web2py.com/examples/epydoc are reeeally old and 
>> buggy. The new api documentation is on readthedocs 
>> <http://web2py.readthedocs.org/en/latest/>
>>
>> Now... if you want to pass a StringIO to response.stream, you have to 
>> "rewind" it to 0 before passing it ....
>>
>> s = cStringIO.StringIO()
>> rows.export_to_csv_file(s, represent=False)
>> s.seek(0)   #<---
>> return response.stream(s, attachment=True, filename='categories.csv')
>>
>>
>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/71tdm80FVls/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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