view 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
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)