I don't get it. Why do you need ajax for a download? Why not a simple link? If you want you can make it look like a button too.
Quinta-feira, 18 de Outubro de 2012 7:09:09 UTC+1, weheh escreveu: > > Is it possible to do a response.stream in the middle of an ajax callback? > > I want to give users a button, which if pressed, will tar up all their > files and initiate a download. Something like this: > > TAG.BUTTON(..., _onclick="ajax("%s", [], ':eval');" % > URL(c='mycontroller', f='mydownload')) > > Then later, in mycontroller.py, > > def mydownload(): > ... create tarfile ... > return response.stream(tarfile, attachment=True) > > I tried it, but (perhaps obviously to some) it doesn't work. So, how to > get the mydownload() action to cause the browser to download the tarfile? > --