mirror of https://github.com/django/django.git
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:
parent
903c561294
commit
761c0a49e4
1
AUTHORS
1
AUTHORS
|
@ -100,6 +100,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Marc Fargas <telenieko@telenieko.com>
|
Marc Fargas <telenieko@telenieko.com>
|
||||||
favo@exoweb.net
|
favo@exoweb.net
|
||||||
Bill Fenner <fenner@gmail.com>
|
Bill Fenner <fenner@gmail.com>
|
||||||
|
Stefane Fermgier <sf@fermigier.com>
|
||||||
Matthew Flanagan <http://wadofstuff.blogspot.com>
|
Matthew Flanagan <http://wadofstuff.blogspot.com>
|
||||||
Eric Floehr <eric@intellovations.com>
|
Eric Floehr <eric@intellovations.com>
|
||||||
Jorge Gajon <gajon@gajon.org>
|
Jorge Gajon <gajon@gajon.org>
|
||||||
|
|
|
@ -9,7 +9,7 @@ been reviewed for security issues. Don't use it for production use.
|
||||||
|
|
||||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
from types import ListType, StringType
|
from types import ListType, StringType
|
||||||
import os, re, sys, time, urllib
|
import os, re, sys, time, urllib, mimetypes
|
||||||
|
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
|
__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
|
||||||
|
@ -629,6 +629,9 @@ class AdminMediaHandler(object):
|
||||||
else:
|
else:
|
||||||
status = '200 OK'
|
status = '200 OK'
|
||||||
headers = {}
|
headers = {}
|
||||||
|
mime_type = mimetypes.guess_type(file_path)[0]
|
||||||
|
if mime_type:
|
||||||
|
headers['Content-Type'] = mime_type
|
||||||
output = [fp.read()]
|
output = [fp.read()]
|
||||||
fp.close()
|
fp.close()
|
||||||
start_response(status, headers.items())
|
start_response(status, headers.items())
|
||||||
|
|
Loading…
Reference in New Issue