diff options
| author | ianb <devnull@localhost> | 2005-05-22 06:37:22 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-22 06:37:22 +0000 |
| commit | 006ca08cfa44c14086d88b63effcca73b8c515ff (patch) | |
| tree | 71411e95c45e8b19b86a82b84db6e9172322afee /paste | |
| parent | 35f8b4a8a9ecbb9a045f95965828057a3a219f49 (diff) | |
| download | paste-006ca08cfa44c14086d88b63effcca73b8c515ff.tar.gz | |
Added docs
Diffstat (limited to 'paste')
| -rw-r--r-- | paste/wdg_validate.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/paste/wdg_validate.py b/paste/wdg_validate.py index ad8ee46..31e4a9d 100644 --- a/paste/wdg_validate.py +++ b/paste/wdg_validate.py @@ -1,24 +1,36 @@ -""" -Middleware that checks HTML and appends messages about the validity of -the HTML. Uses: http://www.htmlhelp.com/tools/validator/ -- interacts -with the command line client. Use the configuration ``wdg_path`` to -override the path (default: looks for ``validate`` in $PATH). - -To install, in your web context's __init__.py:: - - def urlparser_wrap(environ, start_response, app): - return wdg_validate.WDGValidateMiddleware(app)( - environ, start_response) -""" - from cStringIO import StringIO import subprocess from paste import wsgilib +from paste.docsupport import metadata import re import cgi +__all__ = ['WDGValidateMiddleware'] + class WDGValidateMiddleware(object): + """ + Middleware that checks HTML and appends messages about the validity of + the HTML. Uses: http://www.htmlhelp.com/tools/validator/ -- interacts + with the command line client. Use the configuration ``wdg_path`` to + override the path (default: looks for ``validate`` in $PATH). + + To install, in your web context's __init__.py:: + + def urlparser_wrap(environ, start_response, app): + return wdg_validate.WDGValidateMiddleware(app)( + environ, start_response) + + Or in your configuration:: + + middleware.append('paste.wdg_validate.WDGValidateMiddleware') + """ + + _config_wdg_path = metadata.Config( + """ + The path to the ``validate`` executable. ($PATH will be searched) + """, default='validate') + _end_body_regex = re.compile(r'</body>', re.I) def __init__(self, app): |
