Mercurial > hg > contenttransformer
diff contenttransformer/app.py @ 9:051d4d39b4b9
* separate out get_response to its own function
* keep track of raw content_type for later usage (muahaha)
author | k0s <k0scist@gmail.com> |
---|---|
date | Sun, 07 Feb 2010 19:03:15 -0500 |
parents | 5258325a496a |
children | a9ddcfc7c4e8 |
line wrap: on
line diff
--- a/contenttransformer/app.py Sun Feb 07 18:52:40 2010 -0500 +++ b/contenttransformer/app.py Sun Feb 07 19:03:15 2010 -0500 @@ -1,6 +1,7 @@ import os import sys from fnmatch import fnmatch +from mimetypes import guess_type from paste.fileapp import FileApp from pkg_resources import iter_entry_points @@ -23,8 +24,9 @@ filename = os.path.basename(path) for pattern, transformer_name in self.types: if fnmatch(filename, pattern): + content_type, _ = guess_type(filename) content = file(path).read() - return self.transformers[transformer_name](content) + return self.transformers[transformer_name](content, content_type) return FileApp(path)