Fixed #866: static.serve view no longer opens files in text mode -- thanks, Eugene

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1331 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2005-11-21 13:06:51 +00:00
parent a87d43f809
commit b4d379d5e1
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ def serve(request, path, document_root=None, show_indexes=False):
raise Http404, '"%s" does not exist' % fullpath raise Http404, '"%s" does not exist' % fullpath
else: else:
mimetype = mimetypes.guess_type(fullpath)[0] mimetype = mimetypes.guess_type(fullpath)[0]
return HttpResponse(open(fullpath).read(), mimetype=mimetype) return HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype)
DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">