diff options
author | ianb <devnull@localhost> | 2007-02-19 00:04:47 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2007-02-19 00:04:47 +0000 |
commit | 13f2b58b6f8d9695522137b759c7a5d1dcd356b3 (patch) | |
tree | b888c00306da9affc2c2b7a1b009340e7686ad27 | |
parent | 1cf4f03c6a0347ea8bf64b8b6e1f7c72572a33c8 (diff) | |
download | paste-13f2b58b6f8d9695522137b759c7a5d1dcd356b3.tar.gz |
make guess_type overridable
-rw-r--r-- | docs/news.txt | 3 | ||||
-rw-r--r-- | paste/fileapp.py | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/docs/news.txt b/docs/news.txt index bd08c6e..24688c3 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -11,7 +11,8 @@ svn trunk * In ``paste.fileapp``, if the client sends both If-None-Match and If-Modified-Since, prefer If-None-Match. Make ETags include the - size as well as last modified timestamp. + size as well as last modified timestamp. Make it possible to + override how mimetypes are guessed. 1.2.1 ----- diff --git a/paste/fileapp.py b/paste/fileapp.py index dce8780..a2c1413 100644 --- a/paste/fileapp.py +++ b/paste/fileapp.py @@ -169,13 +169,16 @@ class FileApp(DataApp): def __init__(self, filename, headers=None, **kwargs): self.filename = filename - content_type, content_encoding = mimetypes.guess_type(self.filename) + content_type, content_encoding = self.guess_type() if content_type and 'content_type' not in kwargs: kwargs['content_type'] = content_type if content_encoding and 'content_encoding' not in kwargs: kwargs['content_encoding'] = content_encoding DataApp.__init__(self, None, headers, **kwargs) + def guess_type(self): + return mimetypes.guess_type(self.filename) + def update(self, force=False): stat = os.stat(self.filename) if not force and stat.st_mtime == self.last_modified: |