Mercurial > hg > contenttransformer
changeset 22:ee3eadc97a41
py3
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 03 Nov 2020 10:53:13 -0800 |
parents | 7ad9bbc070be |
children | 9cf78a1c7373 |
files | contenttransformer/app.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/contenttransformer/app.py Tue Nov 03 08:20:08 2020 -0800 +++ b/contenttransformer/app.py Tue Nov 03 10:53:13 2020 -0800 @@ -4,7 +4,7 @@ from mimetypes import guess_type from paste.fileapp import FileApp from pkg_resources import iter_entry_points -from transformers import ContentTypeChanger +from .transformers import ContentTypeChanger class FileTypeTransformer(object): @@ -14,14 +14,14 @@ # arguments to the xformers self.kwargs = kwargs - + self.transformers = transformers() for pattern, transformer_name in self.types: if '/' in transformer_name: continue assert transformer_name in self.transformers, '%s not in transformers' % transformer_name - def __call__(self, path): + def __call__(self, path): """this should return something that is callable with (environ, start_response) to return a response; the transformer thing""" filename = os.path.basename(path) for pattern, transformer_name in self.types: @@ -33,7 +33,7 @@ # XXX hack: -> refactor if '/' in transformer_name: return ContentTypeChanger(content, content_type, transformer_name) - return self.transformers[transformer_name](content, content_type, **self.kwargs.get(transformer_name, {})) + return self.transformers[transformer_name](content, content_type, **self.kwargs.get(transformer_name, {})) return FileApp(path) @@ -45,4 +45,4 @@ except: raise # XXX return transformers - +