Ticket #7535: static.py.3.patch
File static.py.3.patch, 907 bytes (added by , 16 years ago) |
---|
-
static.py
59 59 if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'), 60 60 statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]): 61 61 return HttpResponseNotModified() 62 mimetype = mimetypes.guess_type(fullpath)[0] or 'application/octet-stream' 62 63 mimetype, encoding = mimetypes.guess_type(fullpath) 64 mimetype = mimetype or 'application/octet-stream' 65 63 66 contents = open(fullpath, 'rb').read() 64 67 response = HttpResponse(contents, mimetype=mimetype) 68 65 69 response["Last-Modified"] = http_date(statobj[stat.ST_MTIME]) 70 if encoding: 71 response["Content-Encoding"] = encoding 66 72 response["Content-Length"] = len(contents) 73 67 74 return response 68 75 69 76 DEFAULT_DIRECTORY_INDEX_TEMPLATE = """