comparison pspx.html @ 3:c6902cded64d draft

Corrections and reorg.
author David Barts <n5jrn@me.com>
date Mon, 13 May 2019 06:53:08 -0700
parents ca6f8ca38cf2
children 31bb8400e6e3
comparison
equal deleted inserted replaced
2:ca6f8ca38cf2 3:c6902cded64d
16 <p>The header is optional and consists of lines starting with an octothorpe 16 <p>The header is optional and consists of lines starting with an octothorpe
17 (#) character. With the exception of the <code>#rem </code>header, all 17 (#) character. With the exception of the <code>#rem </code>header, all
18 header lines may appear only once in a given file.</p> 18 header lines may appear only once in a given file.</p>
19 <dl> 19 <dl>
20 <dt><code>#errors</code></dt> 20 <dt><code>#errors</code></dt>
21 <dd>This is an error page which handles the specified HTTP error codes. 21 <dd>Ignore other headers and make this is an error page which handles
22 The codes are specified in numeric form, separated by whitespace. If no 22 the specified HTTP error codes. See the subsection on error pages below.
23 error codes are specified, this page handles all possible HTTP error 23 </dd>
24 codes.</dd>
25 <dt><code>#forward</code></dt> 24 <dt><code>#forward</code></dt>
26 <dd>Ignore everything else in this template (and any code-behind 25 <dd>Ignore everything else in this template (and any code-behind
27 associated with it), using the specified route to serve it instead. The 26 associated with it), using the specified route to serve it instead. The
28 route specified with <code>#forward</code> may itself contain a <code>#forward</code>, 27 route specified with <code>#forward</code> may itself contain a <code>#forward</code>,
29 but attempts to create a <code>#forward</code> loop are not allowed and 28 but attempts to create a <code>#forward</code> loop are not allowed and
44 the same name but an extension of <span class="kbd">.py</span>.</dd> 43 the same name but an extension of <span class="kbd">.py</span>.</dd>
45 <dt><code>#rem</code></dt> 44 <dt><code>#rem</code></dt>
46 <dd>The rest of the line is treated as a remark (comment) and is ignored.</dd> 45 <dd>The rest of the line is treated as a remark (comment) and is ignored.</dd>
47 <dt><code>#template</code></dt> 46 <dt><code>#template</code></dt>
48 <dd>Ignore the body of this file and instead use the template in the body 47 <dd>Ignore the body of this file and instead use the template in the body
49 of the specified file, which must end in <span class="kbd">.pspx</span>.</dd> 48 of the specified file, which must end in <span class="kbd">.pspx</span>.
49 Any headers in the referred template file are ignored.</dd>
50 </dl> 50 </dl>
51 <p>It is possible to include whitespace and special characters in arguments 51 <p>It is possible to include whitespace and special characters in arguments
52 to the <code>#forward</code>, <code>#python</code>, and <code>#template</code> 52 to the <code>#forward</code>, <code>#python</code>, and <code>#template</code>
53 headers by using standard Python string quoting and escaping methods. For 53 headers by using standard Python string quoting and escaping methods. For
54 example, <code>#python "space case.py"</code>.</p> 54 example, <code>#python "space case.py"</code>.</p>
55 <h3>Error Pages</h3> 55 <h3>Error Pages</h3>
56 <p>Error pages supersede the standard Bottle error handling, and are created 56 <p>Error pages supersede the standard Bottle error handling, and are created
57 by using the <code>#error</code> page header. <em>Error pages have no 57 by using the <code>#errors</code> page header. <em>Error pages have no
58 associated code-behind;</em> they consist of templates only. Error page 58 associated code-behind;</em> they consist of templates only. Error page
59 templates are provided with two variables when rendering:</p> 59 templates are provided with two variables when rendering:</p>
60 <dl> 60 <dl>
61 <dt><code>e</code></dt> 61 <dt><code>e</code></dt>
62 <dd>The <code>bottle.HTTPError</code> object associated with this error.</dd> 62 <dd>The <code>bottle.HTTPError</code> object associated with this error.</dd>
63 <dt><code>request</code></dt> 63 <dt><code>request</code></dt>
64 <dd>The <code>bottle.Request</code> object associated with this error.</dd> 64 <dd>The <code>bottle.Request</code> object associated with this error.</dd>
65 </dl> 65 </dl>
66 <p>The behavior of specifying multiple error pages for the same error code 66 <p>The <code>#errors</code> directive takes a list of numeric error codes
67 (values from 400 to 599 are allowed); the page is created to handle the
68 specified errors. If no error codes are specified, the page will handle all
69 errors. The behavior of specifying multiple error pages for the same error code
67 is undefined; doing so is best avoided.</p> 70 is undefined; doing so is best avoided.</p>
68 <h2>The Body</h2> 71 <h2>The Body</h2>
69 <p>The body begins with the first line that <em>does not</em> start with <code>#</code> 72 <p>The body begins with the first line that <em>does not</em> start with <code>#</code>
70 and has the exact same syntax that the templates are in for this webapp. 73 and has the exact same syntax that the templates are in for this webapp.
71 By default, Chameleon templates are used. Cheetah, Jinja2, Mako, and 74 By default, Chameleon templates are used. Cheetah, Jinja2, Mako, and