Mercurial > hg > wsgintegrate
changeset 12:89047fd9ea8f
whitespace
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 17 Nov 2011 11:26:33 -0800 |
parents | 88b611ed2c5e |
children | bb66c9a62be9 |
files | wsgintegrate/match.py |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/wsgintegrate/match.py Thu Jul 14 00:05:39 2011 -0700 +++ b/wsgintegrate/match.py Thu Nov 17 11:26:33 2011 -0800 @@ -7,16 +7,16 @@ class RequestMatch(object): """abstract base class for matching requests""" - + def __init__(self, app): self.app = app - + def __call__(self, environ, start_response): """WSGI app""" if not self.condition(environ): raise exc.HTTPNotFound return self.app(environ, start_response) - + def condition(self, environ): """match condition""" return True @@ -32,20 +32,20 @@ class MatchPath(RequestMatch): """match based on PATH INFO""" - + def __init__(self, app, path): RequestMatch.__init__(self, app) self.path = path - + def match(self, path): if path.startswith(self.path): # currently only matches with str.startswith; # different types of matches could be considered return self.path, path[len(self.path):] - + def condition(self, environ): # XXX unused return self.match(environ['PATH_INFO']) is not None - + def __call__(self, environ, start_response): match = self.match(environ['PATH_INFO']) if match is None: @@ -55,12 +55,12 @@ # fix up the environment for downstream applications environ['SCRIPT_NAME'] = script_name environ['PATH_INFO'] = path_info - + return self.app(environ, start_response) class MatchMethod(RequestMatch): """match based on request method""" - + def __init__(self, app, methods): RequestMatch.__init__(self, app) if isinstance(methods, basestring):