dont set None as content_type

This commit is contained in:
j 2011-10-21 18:37:51 +02:00
parent c87a6eddba
commit 5e0193d149

View file

@ -24,11 +24,13 @@ def HttpFileResponse(path, content_type=None, filename=None):
if root and path.startswith(root):
path = url + path[len(root)+1:]
response['X-Accel-Redirect'] = path
response['Content-Type'] = content_type
if content_type:
response['Content-Type'] = content_type
elif getattr(settings, 'XSENDFILE', False):
response = HttpResponse()
response['X-Sendfile'] = path
response['Content-Type'] = content_type
if content_type:
response['Content-Type'] = content_type
response['Content-Length'] = os.stat(path).st_size
else:
response = HttpResponse(open(path), content_type=content_type)