Ticket #7535: static.py.patch
File static.py.patch, 905 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 mimetype = ('application/octet-stream', 'identity') 63 mimetype = mimetypes.guess_type(fullpath) or mimetype 63 64 contents = open(fullpath, 'rb').read() 64 response = HttpResponse(contents, mimetype=mimetype )65 response = HttpResponse(contents, mimetype=mimetype[0]) 65 66 response["Last-Modified"] = http_date(statobj[stat.ST_MTIME]) 67 response["Content-Encoding"] = mimetype[1] 66 68 response["Content-Length"] = len(contents) 67 69 return response 68 70