changeset 14:7dae51af8db6

ugly f-ing hack
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 30 Jun 2010 22:32:33 -0700
parents 9d51954e2e68
children 946176949bba
files contenttransformer/app.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contenttransformer/app.py
+++ b/contenttransformer/app.py
@@ -14,32 +14,31 @@ class FileTypeTransformer(object):
 
         # 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
+            assert transformer_name in self.transformers, '%s not in transformers' % transformer_name
 
     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:
             if fnmatch(filename, pattern):
                 content_type, _ = guess_type(filename)
                 content = file(path).read()
 
                 # transform content type
                 # 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.lower(), {})) # XXX hack around ini being retarded
         return FileApp(path)
 
 
 def transformers():
     transformers = {} # XXX could cache
     for entry_point in iter_entry_points('content_transformers'):
         try:
             transformers[entry_point.name] = entry_point.load()