diff options
author | ianb <devnull@localhost> | 2005-05-22 06:27:35 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-05-22 06:27:35 +0000 |
commit | 6e427f51ff3e215b00325cbf758f16779f9f776a (patch) | |
tree | e099d29494ae8d241ed2869c74d8134d0c42bad0 /paste/lint.py | |
parent | 3a50de28d713b61aab14bc5b2219b226b4e058b8 (diff) | |
download | paste-6e427f51ff3e215b00325cbf758f16779f9f776a.tar.gz |
Added documentation
Diffstat (limited to 'paste/lint.py')
-rw-r--r-- | paste/lint.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/paste/lint.py b/paste/lint.py index 9cb06ea..980ef4f 100644 --- a/paste/lint.py +++ b/paste/lint.py @@ -1,9 +1,3 @@ -""" -A lint of sorts; an anal middleware that checks for WSGI compliance -both in the server and the application (but otherwise does not effect -the request, it just looks at the communication). -""" - import re import sys from types import * @@ -12,6 +6,17 @@ header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$') bad_header_value_re = re.compile(r'[\000-\037]') def middleware(application): + + """ + When applied between a WSGI server and a WSGI application, this + middleware will check for WSGI compliancy on a number of levels. + This middleware does not modify the request or response in any + way, but will throw an AssertionError if anything seems off + (except for a failure to close the application iterator, which + will be printed to stderr -- there's no way to throw an exception + at that point). + """ + def lint_app(*args, **kw): assert len(args) == 2, "Two arguments required" assert not kw, "No keyword arguments allowed" @@ -277,3 +282,5 @@ def check_iterator(iterator): assert not isinstance(iterator, str), ( "You should not return a string as your application iterator, " "instead return a single-item list containing that string.") + +__all__ = ['middleware'] |