Mercurial > hg > decoupage
changeset 41:8ba2f1087880
and a commit following a merge, goody goody...lets get a snack
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 30 Jun 2010 22:33:59 -0700 |
parents | 89f7a8ca965c (diff) 677e2fe1239c (current diff) |
children | e0e1a339070c |
files | |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/decoupage/web.py Mon Jun 21 18:55:15 2010 -0700 +++ b/decoupage/web.py Wed Jun 30 22:33:59 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