Mercurial > hg > theslasher
view theslasher/__init__.py @ 0:3812c1493dde default tip
add the slasher...be afraid, be very afraid
author | k0s <k0scist@gmail.com> |
---|---|
date | Mon, 11 Jan 2010 17:50:36 -0500 |
parents | |
children |
line wrap: on
line source
""" request dispatcher """ from webob import Request, exc class TheSlasher(object): ### class level variables def __init__(self, app): self.app = app ### methods dealing with HTTP def __call__(self, environ, start_response): request = Request(environ) if request.path_info.endswith('/') and (request.path_info != '/'): location = request.path_info.rstrip('/') return exc.HTTPMovedPermanently(location=location)(environ, start_response) return self.app(environ, start_response)