Mercurial > hg > decoupage
changeset 40:89f7a8ca965c
add arguments to transformers....configparser is somewhat retarded about capitalization so im going to be somewhat retarded here rather than google for how to fix right now. lame
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 30 Jun 2010 22:33:26 -0700 |
parents | 9ba237db4cde |
children | 8ba2f1087880 |
files | decoupage/web.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/decoupage/web.py Mon Mar 08 11:06:56 2010 -0500 +++ b/decoupage/web.py Wed Jun 30 22:33:26 2010 -0700 @@ -5,6 +5,7 @@ import os from contenttransformer.app import FileTypeTransformer +from contenttransformer.app import transformers from formatters import formatters from genshi.builder import Markup @@ -16,6 +17,8 @@ from pkg_resources import iter_entry_points from webob import Request, Response, exc +transformers = [i.lower() for i in transformers()] + class Decoupage(object): ### class level variables @@ -45,7 +48,7 @@ assert os.path.isdir(directory), "Decoupage template directory %s does not exist!" % directory # static file server - self.fileserver = FileApp + self.fileserver = FileApp # XXX still used?!? # pluggable index data formatters self.formatters = {} @@ -82,7 +85,13 @@ conf = self.conf(request.path_info.rsplit('/',1)[0]) if '/transformer' in conf: args = [i.split('=', 1) for i in conf['/transformer'].split(',') if '=' in i] - fileserver = FileTypeTransformer(*args) + kwargs = {} + for i in conf: + if i.startswith('/'): + name = i[1:].lower() + if name in transformers: + kwargs[name] = dict([j.split('=', 1) for j in conf[i].split(',') if '=' in j]) + fileserver = FileTypeTransformer(*args, **kwargs) else: fileserver = FileApp