annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
1 from ${package} import View
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
2 from paste.httpexceptions import HTTPExceptionHandler
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
3
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
4 def factory(global_conf, **app_conf):
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
5 """create a webob view and wrap it in middleware"""
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
6 keystr = '${project}.'
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
7 args = dict([(key.split(keystr, 1)[-1], value)
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
8 for key, value in app_conf.items()
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
9 if key.startswith(keystr) ])
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
10 app = View(**args)
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
11 return HTTPExceptionHandler(app)
72cb6dc31e3f initial commit of webob_view from https://svn.openplans.org/svn/standalone/templates/webob_view/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
12