Mercurial > hg > decoupage
comparison decoupage/factory.py @ 63:9c570aed2246
move app_conf parsing logic to factory.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 14 Dec 2010 22:03:50 -0800 |
parents | 6a802c87f070 |
children | 450aff4c97e3 |
comparison
equal
deleted
inserted
replaced
62:0890ec7069f3 | 63:9c570aed2246 |
---|---|
1 from web import Decoupage | 1 from web import Decoupage |
2 from paste.httpexceptions import HTTPExceptionHandler | 2 from paste.httpexceptions import HTTPExceptionHandler |
3 | 3 |
4 def namespace_conf(keystr, app_conf): | |
5 keystr += '.' | |
6 return dict([(key.split(keystr, 1)[-1], value) | |
7 for key, value in app_conf.items() | |
8 if key.startswith(keystr) ]) | |
9 | |
10 | |
4 def factory(global_conf, **app_conf): | 11 def factory(global_conf, **app_conf): |
5 """create a webob view and wrap it in middleware""" | 12 """create a webob view and wrap it in middleware""" |
13 app_conf = namespace_conf('decoupage', app_conf) | |
6 app = Decoupage(**app_conf) | 14 app = Decoupage(**app_conf) |
7 return HTTPExceptionHandler(app) | 15 return HTTPExceptionHandler(app) |
8 | 16 |