comparison pspx.html @ 5:31bb8400e6e3 draft

Add #end header, fix #errors.
author David Barts <n5jrn@me.com>
date Mon, 13 May 2019 14:47:04 -0700
parents c6902cded64d
children a3823da7bb45
comparison
equal deleted inserted replaced
4:0d47859f792a 5:31bb8400e6e3
15 <h2>The Header</h2> 15 <h2>The Header</h2>
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>#end</code></dt>
21 <dd>Marks the last line of the headers. Needed only for templating
22 languages where lines often start with <span class="kbd">#</span>, such
23 as Cheetah.</dd>
24 <dd> <br>
25 </dd>
20 <dt><code>#errors</code></dt> 26 <dt><code>#errors</code></dt>
21 <dd>Ignore other headers and make this is an error page which handles 27 <dd>Ignore other headers and make this is an error page which handles the
22 the specified HTTP error codes. See the subsection on error pages below. 28 specified HTTP error codes. See the subsection on error pages below. </dd>
23 </dd>
24 <dt><code>#forward</code></dt> 29 <dt><code>#forward</code></dt>
25 <dd>Ignore everything else in this template (and any code-behind 30 <dd>Ignore everything else in this template (and any code-behind
26 associated with it), using the specified route to serve it instead. The 31 associated with it), using the specified route to serve it instead. The
27 route specified with <code>#forward</code> may itself contain a <code>#forward</code>, 32 route specified with <code>#forward</code> may itself contain a <code>#forward</code>,
28 but attempts to create a <code>#forward</code> loop are not allowed and 33 but attempts to create a <code>#forward</code> loop are not allowed and
32 happen at request time.</dd> 37 happen at request time.</dd>
33 <dt><code>#hidden</code></dt> 38 <dt><code>#hidden</code></dt>
34 <dd>This is a hidden page; do not create a route for it. The page can only 39 <dd>This is a hidden page; do not create a route for it. The page can only
35 be displayed by a forward.</dd> 40 be displayed by a forward.</dd>
36 <dt><code>#methods</code></dt> 41 <dt><code>#methods</code></dt>
37 <dd>A list of HTTP request methods, separated by whitespace, follows. The route will 42 <dd>A list of HTTP request methods, separated by whitespace, follows. The
38 allow all specified methods. Not specifying this line is equivalent to 43 route will allow all specified methods. Not specifying this line is
39 specifying <code>#methods GET</code>.</dd> 44 equivalent to specifying <code>#methods GET</code>.</dd>
40 <dt><code>#python</code></dt> 45 <dt><code>#python</code></dt>
41 <dd>What follows is the name of the Python file containing the code-behind 46 <dd>What follows is the name of the Python file containing the code-behind
42 for this route. If not specified, the code-behind will be in a file with 47 for this route. If not specified, the code-behind will be in a file with
43 the same name but an extension of <span class="kbd">.py</span>.</dd> 48 the same name but an extension of <span class="kbd">.py</span>.</dd>
44 <dt><code>#rem</code></dt> 49 <dt><code>#rem</code></dt>
56 <p>Error pages supersede the standard Bottle error handling, and are created 61 <p>Error pages supersede the standard Bottle error handling, and are created
57 by using the <code>#errors</code> page header. <em>Error pages have no 62 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 63 associated code-behind;</em> they consist of templates only. Error page
59 templates are provided with two variables when rendering:</p> 64 templates are provided with two variables when rendering:</p>
60 <dl> 65 <dl>
61 <dt><code>e</code></dt> 66 <dt><code>error</code></dt>
62 <dd>The <code>bottle.HTTPError</code> object associated with this error.</dd> 67 <dd>The <code>bottle.HTTPError</code> object associated with this error.</dd>
63 <dt><code>request</code></dt> 68 <dt><code>request</code></dt>
64 <dd>The <code>bottle.Request</code> object associated with this error.</dd> 69 <dd>The <code>bottle.Request</code> object associated with this error.</dd>
65 </dl> 70 </dl>
66 <p>The <code>#errors</code> directive takes a list of numeric error codes 71 <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 72 (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 73 specified errors. If no error codes are specified, the page will handle
69 errors. The behavior of specifying multiple error pages for the same error code 74 all errors. The behavior of specifying multiple error pages for the same
70 is undefined; doing so is best avoided.</p> 75 error code is undefined; doing so is best avoided.</p>
71 <h2>The Body</h2> 76 <h2>The Body</h2>
72 <p>The body begins with the first line that <em>does not</em> start with <code>#</code> 77 <p>The body begins with the first line that <em>does not</em> start with <code>#</code>
73 and has the exact same syntax that the templates are in for this webapp. 78 and has the exact same syntax that the templates are in for this webapp.
74 By default, Chameleon templates are used. Cheetah, Jinja2, Mako, and 79 By default, Chameleon templates are used. Cheetah, Jinja2, Mako, and
75 Bottle SimpleTemplate templates are also supported, provided the webapp 80 Bottle SimpleTemplate templates are also supported, provided the webapp