From e9a71dfd96bb42791ff97a5e6da5b0c8aa4a606e Mon Sep 17 00:00:00 2001 From: Klee Dienes Date: Mon, 31 Oct 2011 01:41:11 +0000 Subject: Properly process MIME encoding. --- CONTRIBUTORS.txt | 2 ++ pyramid/static.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index a368fb4d2..648f67c72 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -148,3 +148,5 @@ Contributors - Shane Hathaway, 2011/07/22 - Manuel Hermann, 2011/07/11 + +- Klee Dienes, 2011/10/30 diff --git a/pyramid/static.py b/pyramid/static.py index 50a8b918b..2a9abbd8f 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -43,10 +43,11 @@ class _FileResponse(Response): def __init__(self, path, cache_max_age): super(_FileResponse, self).__init__(conditional_response=True) self.last_modified = getmtime(path) - content_type = mimetypes.guess_type(path, strict=False)[0] + content_type, content_encoding = mimetypes.guess_type(path, strict=False) if content_type is None: content_type = 'application/octet-stream' self.content_type = content_type + self.content_encoding = content_encoding content_length = getsize(path) self.app_iter = _FileIter(open(path, 'rb'), content_length) # assignment of content_length must come after assignment of app_iter -- cgit v1.2.3