do you serve a StringIO instance ? for 2. you may try response.stream(yourcsvinstance, filename='foo.csv', attachment=True)
On Friday, October 26, 2012 1:13:17 AM UTC+2, Jonathan Lundell wrote: > > I want to build a dataset (list of lists) in response to a user request > and cause a csv of that dataset to be downloaded. > > I have a working but ugly implementation that uses @service.csv. If I > access the URL > > http://domain.com/app/default/call/csv/foo > > ...it works OK and downloads a file named 'foo'. > > A couple of questions. > > 1. Is there a better way (considering that this is a user request, not > really a web service per se)? > > 2. How do I make the downloaded file, above, be named foo.csv? Maybe set > request.extension? (I tried call.csv in the URL, which still downloaded > 'foo'.) > > 3. Can I combine @auth.requires_something with @service.csv? > > Thanks! --