/usr/share/doc/python-paste/docs/modules/lint.html is in python-paste 1.7.5.1-6ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>paste.lint – Check for the validity of WSGI requests and responses — Paste 1.7.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.7.5.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Paste 1.7.5.1 documentation" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-paste.lint">
<span id="paste-lint-check-for-the-validity-of-wsgi-requests-and-responses"></span><h1><a class="reference internal" href="#module-paste.lint" title="paste.lint"><tt class="xref py py-mod docutils literal"><span class="pre">paste.lint</span></tt></a> – Check for the validity of WSGI requests and responses<a class="headerlink" href="#module-paste.lint" title="Permalink to this headline">¶</a></h1>
<p>Middleware to check for obedience to the WSGI specification.</p>
<p>Some of the things this checks:</p>
<ul class="simple">
<li>Signature of the application and start_response (including that
keyword arguments are not used).</li>
<li>Environment checks:<ul>
<li>Environment is a dictionary (and not a subclass).</li>
<li>That all the required keys are in the environment: REQUEST_METHOD,
SERVER_NAME, SERVER_PORT, wsgi.version, wsgi.input, wsgi.errors,
wsgi.multithread, wsgi.multiprocess, wsgi.run_once</li>
<li>That HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH are not in the
environment (these headers should appear as CONTENT_LENGTH and
CONTENT_TYPE).</li>
<li>Warns if QUERY_STRING is missing, as the cgi module acts
unpredictably in that case.</li>
<li>That CGI-style variables (that don’t contain a .) have
(non-unicode) string values</li>
<li>That wsgi.version is a tuple</li>
<li>That wsgi.url_scheme is ‘http’ or ‘https’ (@@: is this too
restrictive?)</li>
<li>Warns if the REQUEST_METHOD is not known (@@: probably too
restrictive).</li>
<li>That SCRIPT_NAME and PATH_INFO are empty or start with /</li>
<li>That at least one of SCRIPT_NAME or PATH_INFO are set.</li>
<li>That CONTENT_LENGTH is a positive integer.</li>
<li>That SCRIPT_NAME is not ‘/’ (it should be ‘’, and PATH_INFO should
be ‘/’).</li>
<li>That wsgi.input has the methods read, readline, readlines, and
__iter__</li>
<li>That wsgi.errors has the methods flush, write, writelines</li>
</ul>
</li>
<li>The status is a string, contains a space, starts with an integer,
and that integer is in range (> 100).</li>
<li>That the headers is a list (not a subclass, not another kind of
sequence).</li>
<li>That the items of the headers are tuples of strings.</li>
<li>That there is no ‘status’ header (that is used in CGI, but not in
WSGI).</li>
<li>That the headers don’t contain newlines or colons, end in _ or -, or
contain characters codes below 037.</li>
<li>That Content-Type is given if there is content (CGI often has a
default content type, but WSGI does not).</li>
<li>That no Content-Type is given when there is no content (@@: is this
too restrictive?)</li>
<li>That the exc_info argument to start_response is a tuple or None.</li>
<li>That all calls to the writer are with strings, and no other methods
on the writer are accessed.</li>
<li>That wsgi.input is used properly:<ul>
<li>.read() is called with zero or one argument</li>
<li>That it returns a string</li>
<li>That readline, readlines, and __iter__ return strings</li>
<li>That .close() is not called</li>
<li>No other methods are provided</li>
</ul>
</li>
<li>That wsgi.errors is used properly:<ul>
<li>.write() and .writelines() is called with a string</li>
<li>That .close() is not called, and no other methods are provided.</li>
</ul>
</li>
<li>The response iterator:<ul>
<li>That it is not a string (it should be a list of a single string; a
string will work, but perform horribly).</li>
<li>That .next() returns a string</li>
<li>That the iterator is not iterated over until start_response has
been called (that can signal either a server or application
error).</li>
<li>That .close() is called (doesn’t raise exception, only prints to
sys.stderr, because we only know it isn’t called when the object
is garbage collected).</li>
</ul>
</li>
</ul>
<div class="section" id="module-contents">
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="paste.lint.middleware">
<tt class="descclassname">paste.lint.</tt><tt class="descname">middleware</tt><big>(</big><em>application</em>, <em>global_conf=None</em><big>)</big><a class="headerlink" href="#paste.lint.middleware" title="Permalink to this definition">¶</a></dt>
<dd><p>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).</p>
</dd></dl>
<dl class="exception">
<dt id="paste.lint.WSGIWarning">
<em class="property">exception </em><tt class="descclassname">paste.lint.</tt><tt class="descname">WSGIWarning</tt><a class="headerlink" href="#paste.lint.WSGIWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>Raised in response to WSGI-spec-related warnings</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">paste.lint</span></tt> – Check for the validity of WSGI requests and responses</a><ul>
<li><a class="reference internal" href="#module-contents">Module Contents</a></li>
</ul>
</li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/lint.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Ian Bicking.
Last updated on Apr 11, 2014.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
|