view webob_view/template/+package+/factory.py_tmpl @ 8:87bac4e6b908 default tip

update metadata
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Nov 2020 10:12:55 -0800
parents eb2cb7ebc849
children
line wrap: on
line source

from dispatcher import Dispatcher
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 = Dispatcher(**args)
    return HTTPExceptionHandler(app)