Hello! What is the current right way to stream data in web2py? I'm trying to stream the data using cStringIO and response.stream, but as a best result I get an empty file.
Here is a source snippet: rows = current.db(current.db.categories.belongs(categories)).select() s = cStringIO.StringIO() rows.export_to_csv_file(s, represent=False) return response.stream(s, attachment=True, filename='categories.csv') As a result I get an empty csv file, while s did contain the right data. I couldn't find any clear documentation for response.stream, so I experimented with parameters, but it didn't work. Do I have to set headers manually? Can I stream cStringIO instead of file object? PS: http://web2py.com/examples/static/epydoc/web2py.gluon.globals.Response-class.html#stream and http://web2py.com/examples/static/epydoc/web2py.gluon.globals-pysrc.html#Response.stream show different default keyword arguments: stream(self, stream, chunk_size=65536, request=threading.local(), attachment=True, filename=threading.local()) and def stream( self, stream, chunk_size=DEFAULT_CHUNK_SIZE, request=None, attachment=False, filename=None) correspondingly. -- 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.