git.ithinksw.org
/
philo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5adae76
)
Added Content-Disposition header to File's response - keeps the name of the file...
author
Stephen Burrows
<stephen.r.burrows@gmail.com>
Mon, 6 Jun 2011 20:31:13 +0000
(16:31 -0400)
committer
Stephen Burrows
<stephen.r.burrows@gmail.com>
Mon, 6 Jun 2011 21:26:08 +0000
(17:26 -0400)
philo/models/nodes.py
patch
|
blob
|
history
diff --git
a/philo/models/nodes.py
b/philo/models/nodes.py
index
0c89095
..
93f772a
100644
(file)
--- a/
philo/models/nodes.py
+++ b/
philo/models/nodes.py
@@
-1,5
+1,6
@@
from inspect import getargspec
import mimetypes
+from os.path import basename
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
@@
-388,6
+389,7
@@
class File(View):
wrapper = FileWrapper(self.file)
response = HttpResponse(wrapper, content_type=self.mimetype)
response['Content-Length'] = self.file.size
+ response['Content-Disposition'] = "inline; filename=%s" % basename(self.file.name)
return response
class Meta: