Mercurial > hg > webob_view
diff webob_view/template/+package+/factory.py_tmpl @ 0:72cb6dc31e3f
initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
author | k0s <k0scist@gmail.com> |
---|---|
date | Tue, 27 Oct 2009 15:04:33 -0400 |
parents | |
children | eb2cb7ebc849 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webob_view/template/+package+/factory.py_tmpl Tue Oct 27 15:04:33 2009 -0400 @@ -0,0 +1,12 @@ +from ${package} import View +from paste.httpexceptions import HTTPExceptionHandler + +def factory(global_conf, **app_conf): + """create a webob view and wrap it in middleware""" + keystr = '${project}.' + args = dict([(key.split(keystr, 1)[-1], value) + for key, value in app_conf.items() + if key.startswith(keystr) ]) + app = View(**args) + return HTTPExceptionHandler(app) +