Mercurial > hg > TagInTheMiddle
view taginthemiddle/example.py @ 11:fc55d95be553
it is list.index, not list.find, silly!
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 05 May 2010 22:37:42 -0700 |
parents | bf4c763b0313 |
children | 3bf478cb3166 |
line wrap: on
line source
from middleware import Tagger from paste.httpexceptions import HTTPExceptionHandler from paste.urlparser import StaticURLParser from pkg_resources import resource_filename def factory(global_conf, **app_conf): """create an example view and wrap it in tagging middleware""" keystr = 'TagInTheMiddle.' args = dict([(key.split(keystr, 1)[-1], value) for key, value in app_conf.items() if key.startswith(keystr) ]) app = StaticURLParser(app_conf['directory']) tagger = Tagger(app, **args) return HTTPExceptionHandler(tagger)