Mercurial > hg > contenttransformer
diff contenttransformer/transformers.py @ 16:6cbe4172b54b
sketch of how to hook up imports for genshi transformer
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 24 Sep 2010 19:15:13 -0700 |
parents | 946176949bba |
children | afd11b758da0 |
line wrap: on
line diff
--- a/contenttransformer/transformers.py Mon Sep 06 08:45:30 2010 -0700 +++ b/contenttransformer/transformers.py Fri Sep 24 19:15:13 2010 -0700 @@ -1,5 +1,6 @@ import docutils.core import subprocess +from utils import import_path from webob import Request, Response class Transformer(object): @@ -65,7 +66,15 @@ class GenshiTransformer(Transformer): - def __init__(self, content, content_type): + def __init__(self, content, content_type, modules=()): + """ + - modules : strings of modules + """ + self.variables = {} + for path in modules: + module = import_path(path) + name = path.rsplit('.')[-1] + self.variables[name] = module Transformer.__init__(self, content, content_type) def transform(self, request):