summaryrefslogtreecommitdiff
path: root/wsgitools/middlewares.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/middlewares.py')
-rw-r--r--wsgitools/middlewares.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index 17afd76..5ff610f 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -11,10 +11,12 @@ except ImportError:
__all__.append("SubdirMiddleware")
class SubdirMiddleware:
+ """Middleware choosing wsgi applications based on a dict."""
def __init__(self, default, mapping={}):
self.default = default
self.mapping = mapping
def __call__(self, environ, start_response):
+ """wsgi interface"""
app = None
script = environ["PATH_INFO"]
path_info = ""
@@ -219,9 +221,13 @@ class CachingMiddleware:
__all__.append("DictAuthChecker")
class DictAuthChecker:
+ """Verifies usernames and passwords by looking them up in a dict."""
def __init__(self, users):
+ """users is a dict mapping usernames to password."""
self.users = users
def __call__(self, username, password):
+ """check_function interface taking username and password and resulting
+ in a bool."""
return username in self.users and self.users[username] == password
__all__.append("BasicAuthMiddleware")