FileWrapper not needed, is broken

pull/1/head
eric 2016-09-28 18:40:57 -04:00
parent ee0e8be670
commit fc56744371
1 changed files with 2 additions and 3 deletions

View File

@ -834,7 +834,6 @@ def export_csv(request, qid): # questionnaire_id
answers for all subjects.
"""
import tempfile, csv, cStringIO, codecs
from django.core.servers.basehttp import FileWrapper
class UnicodeWriter:
"""
@ -878,11 +877,11 @@ def export_csv(request, qid): # questionnaire_id
row = ["%s/%s" % (subject.id, subject.state), runid] + [
a if a else '--' for a in answer_row]
writer.writerow(row)
fd.seek(0)
response = HttpResponse(FileWrapper(fd), content_type="text/csv")
response = HttpResponse(fd, content_type="text/csv")
response['Content-Length'] = fd.tell()
response['Content-Disposition'] = 'attachment; filename="export-%s.csv"' % qid
fd.seek(0)
return response