view uploader/factory.py @ 3:bb2d34fb5de4

allow to be used as middleware
author k0s <k0scist@gmail.com>
date Sun, 27 Dec 2009 16:27:34 -0500
parents 827f7577f940
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 = 'uploader.'
    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)