annotate clwapp/factory.py @ 0:196f241286f7

initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
author k0s <k0scist@gmail.com>
date Sun, 01 Nov 2009 18:24:35 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
1 from clwapp import View
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
2 from paste.httpexceptions import HTTPExceptionHandler
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
3
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
4 def factory(global_conf, **app_conf):
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
5 """create a webob view and wrap it in middleware"""
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
6
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
7 config = [ 'command' ]
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
8 key_str = 'clwapp.%s'
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
9 args = dict([(key, app_conf[ key_str % key]) for key in config
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
10 if app_conf.has_key(key_str % key) ])
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
11 app = View(**args)
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
12 return HTTPExceptionHandler(app)
196f241286f7 initial import of clwapp, from https://svn.openplans.org/svn/standalone/clwapp/trunk/
k0s <k0scist@gmail.com>
parents:
diff changeset
13