18.4.4 wsgiref.validate - WSGI conformance checker
When creating new WSGI application objects, frameworks, servers, or middleware, it can be useful to validate the new code's conformance using wsgiref.validate. This module provides a function that creates WSGI application objects that validate communications between a WSGI server or gateway and a WSGI application object, to check both sides for protocol conformance.Note that this utility does not guarantee complete PEP 333 compliance; an absence of errors from this module does not necessarily mean that errors do not exist. However, if this module does produce an error, then it is virtually certain that either the server or application is not 100% compliant.
This module is based on the paste.lint module from Ian Bicking's ``Python Paste'' library.
-
Wrap application and return a new WSGI application object. The
returned application will forward all requests to the original
application, and will check that both the application and
the server invoking it are conforming to the WSGI specification and to
RFC 2616.
Any detected nonconformance results in an AssertionError being raised; note, however, that how these errors are handled is server-dependent. For example, wsgiref.simple_server and other servers based on wsgiref.handlers (that don't override the error handling methods to do something else) will simply output a message that an error has occurred, and dump the traceback to
sys.stderr
or some other error stream.This wrapper may also generate output using the warnings module to indicate behaviors that are questionable but which may not actually be prohibited by PEP 333. Unless they are suppressed using Python command-line options or the warnings API, any such warnings will be written to
sys.stderr
(notwsgi.errors
, unless they happen to be the same object).
See About this document... for information on suggesting changes.