Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4549 -- WSGI server now sets mime type correctly for admin med…

…ia content. Thanks, Stefane Fermgier

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 761c0a49e48fcf1ac6eb335693e0a2cea0a9e247 1 parent 903c561
@adrianholovaty adrianholovaty authored
Showing with 5 additions and 1 deletion.
  1. +1 −0  AUTHORS
  2. +4 −1 django/core/servers/basehttp.py
View
1  AUTHORS
@@ -100,6 +100,7 @@ answer newbie questions, and generally made Django that much better:
Marc Fargas <telenieko@telenieko.com>
favo@exoweb.net
Bill Fenner <fenner@gmail.com>
+ Stefane Fermgier <sf@fermigier.com>
Matthew Flanagan <http://wadofstuff.blogspot.com>
Eric Floehr <eric@intellovations.com>
Jorge Gajon <gajon@gajon.org>
View
5 django/core/servers/basehttp.py
@@ -9,7 +9,7 @@
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from types import ListType, StringType
-import os, re, sys, time, urllib
+import os, re, sys, time, urllib, mimetypes
__version__ = "0.1"
__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
@@ -629,6 +629,9 @@ def __call__(self, environ, start_response):
else:
status = '200 OK'
headers = {}
+ mime_type = mimetypes.guess_type(file_path)[0]
+ if mime_type:
+ headers['Content-Type'] = mime_type
output = [fp.read()]
fp.close()
start_response(status, headers.items())
Please sign in to comment.
Something went wrong with that request. Please try again.