annotate webob_view/template/+package+/factory.py_tmpl @ 1:eb2cb7ebc849

moving to a handler architecture
author k0s <k0scist@gmail.com>
date Thu, 29 Oct 2009 15:08:54 -0400
parents 72cb6dc31e3f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
eb2cb7ebc849 moving to a handler architecture
k0s <k0scist@gmail.com>
parents: 0
diff changeset
1 from dispatcher import Dispatcher
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
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) ])
1
eb2cb7ebc849 moving to a handler architecture
k0s <k0scist@gmail.com>
parents: 0
diff changeset
10 app = Dispatcher(**args)
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
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