This commit is contained in:
j 2011-08-19 20:08:02 +02:00
parent 20346b248a
commit b482ecf707

View file

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
import os import os
import mimetypes import mimetypes
from datetime import datetime, timedelta
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.conf import settings from django.conf import settings
@ -33,5 +34,6 @@ def HttpFileResponse(path, content_type=None, filename=None):
response = HttpResponse(open(path), content_type=content_type) response = HttpResponse(open(path), content_type=content_type)
if filename: if filename:
response['Content-Disposition'] = 'attachment; filename="%s"' % filename response['Content-Disposition'] = 'attachment; filename="%s"' % filename
response['Expires'] = datetime.strftime(datetime.utcnow() + timedelta(days=1), "%a, %d-%b-%Y %H:%M:%S GMT")
return response return response