summaryrefslogtreecommitdiff
path: root/wsgitools/middlewares.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2008-02-28 14:03:55 +0100
committerHelmut Grohne <helmut@subdivi.de>2008-02-28 14:03:55 +0100
commitda7964ce7cbdc0e28c4558caabcf36d384253ed1 (patch)
treefcf9bc383e46bfd64eacc8ebbd5a6b357f3d6ce0 /wsgitools/middlewares.py
parentaa85b52862c598afab383e777688feb9648cfbf0 (diff)
downloadwsgitools-da7964ce7cbdc0e28c4558caabcf36d384253ed1.tar.gz
refactored docstrings for epydoc
Diffstat (limited to 'wsgitools/middlewares.py')
-rw-r--r--wsgitools/middlewares.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index 4020f90..bee0ac3 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -93,14 +93,15 @@ class NoWriteCallableMiddleware:
__all__.append("ContentLengthMiddleware")
class ContentLengthMiddleware:
"""Guesses the content length header if possible.
- Note: The application used must not use the write callable returned by
- start_response."""
+ @note: The application used must not use the write callable returned by
+ start_response."""
def __init__(self, app, maxstore=0):
"""Wraps wsgi application app. It can also store the first result bytes
to possibly return a list of strings which will make guessing the size
of iterators possible. At most maxstore bytes will be accumulated.
Please note that a value larger than 0 will violate the wsgi standard.
The magical value () will make it always gather all data.
+ @type maxstore: number
"""
self.app = app
self.maxstore = maxstore
@@ -181,12 +182,14 @@ class CachingMiddleware:
"""Caches reponses to requests based on SCRIPT_NAME, PATH_INFO and
QUERY_STRING."""
def __init__(self, app, maxage=60, storable=storable, cacheable=cacheable):
- """app is a wsgi application to be cached.
- maxage is the number of seconds a reponse may be cached.
- storable is a predicated that determines whether the response may be
- cached at all based on the environ dict.
- cacheable is a predicate that determines whether this request
- invalidates the cache."""
+ """
+ @param app: is a wsgi application to be cached.
+ @type maxage: number
+ @param maxage: is the number of seconds a reponse may be cached.
+ @param storable: is a predicated that determines whether the response
+ may be cached at all based on the environ dict.
+ @param cacheable: is a predicate that determines whether this request
+ invalidates the cache."""
self.app = app
self.maxage = maxage
self.storable = storable
@@ -238,7 +241,7 @@ __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."""
+ """@param 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
@@ -249,10 +252,11 @@ __all__.append("BasicAuthMiddleware")
class BasicAuthMiddleware:
"""Middleware implementing HTTP Basic Auth."""
def __init__(self, app, check_function, realm='www'):
- """app is a WSGI application.
- check_function is a function taking two arguments username and password
- returning a bool indicating whether the request may is
- allowed."""
+ """
+ @param app: is a WSGI application.
+ @param check_function: is a function taking two arguments username and
+ password returning a bool indicating whether the request may is
+ allowed."""
self.app = app
self.check_function = check_function
self.realm = realm