Fixed #4549 -- WSGI server now sets mime type correctly for admin media content. Thanks, Stefane Fermgier

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-06-20 06:16:56 +00:00
parent 903c561294
commit 761c0a49e4
2 changed files with 5 additions and 1 deletions

View File

@ -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 File

@ -9,7 +9,7 @@ been reviewed for security issues. Don't use it for production use.
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 @@ class AdminMediaHandler(object):
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())