view redirectall/factory.py @ 0:9e2187433034

initial code
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 08 May 2011 18:28:26 -0700
parents
children 3117c5556eca
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 = 'redirectall.'
    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)