Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11757 - Set mimetype when responding with HttpResponseNotModif…

…ied in django.server.static.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12141 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8a109a7bc8e66548e9c47e3aa0cb5a6ea8c02e34 1 parent 73d636f
Jannis Leidel authored January 09, 2010

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/views/static.py
4  django/views/static.py
@@ -56,10 +56,10 @@ def serve(request, path, document_root=None, show_indexes=False):
56 56
         raise Http404, '"%s" does not exist' % fullpath
57 57
     # Respect the If-Modified-Since header.
58 58
     statobj = os.stat(fullpath)
  59
+    mimetype = mimetypes.guess_type(fullpath)[0] or 'application/octet-stream'
59 60
     if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
60 61
                               statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]):
61  
-        return HttpResponseNotModified()
62  
-    mimetype = mimetypes.guess_type(fullpath)[0] or 'application/octet-stream'
  62
+        return HttpResponseNotModified(mimetype=mimetype)
63 63
     contents = open(fullpath, 'rb').read()
64 64
     response = HttpResponse(contents, mimetype=mimetype)
65 65
     response["Last-Modified"] = http_date(statobj[stat.ST_MTIME])

0 notes on commit 8a109a7

Please sign in to comment.
Something went wrong with that request. Please try again.