changeset 13:9d51954e2e68

allow transformers to take kwargs
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 30 Jun 2010 22:09:13 -0700
parents 59496de89997
children 7dae51af8db6
files contenttransformer/app.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/contenttransformer/app.py	Wed Jun 30 22:01:50 2010 -0700
+++ b/contenttransformer/app.py	Wed Jun 30 22:09:13 2010 -0700
@@ -12,8 +12,7 @@
         """types is a list of two-tuples: glob pattern (string), transformer name (string, name of entry point)"""
         self.types = types
 
-        # intended to be arguments to the xformers
-        # XXX unused
+        # arguments to the xformers
         self.kwargs = kwargs
         
         self.transformers = transformers()
@@ -34,8 +33,8 @@
                 # XXX hack: -> refactor
                 if '/' in transformer_name:
                     return ContentTypeChanger(content, content_type, transformer_name)
-                    
-                return self.transformers[transformer_name](content, content_type)
+                
+                return self.transformers[transformer_name](content, content_type, **self.kwargs.get(transformer_name, {}))
         return FileApp(path)