Mercurial > hg > redirectall
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirectall/factory.py Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,12 @@ +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) +