Wednesday, August 1, 2012
Re: returning a zip file for download
OK, I got it working, I'm not sure what the problem was, but calling the loop variable 'file' was overriding the python default file object class
now I'm doing this:
response = HttpResponse(File(file(tmp[1])), mimetype="application/zip")
response['Content-disposition'] = ('attachment; '
'filename="{}"').format(os.path.basename(tmp[1]))
return response
and I'm wondering, what happens with that File object after the response is sent? when does it get closed? isn't there some cleanup code missing?
--
"The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment