| 1 | | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | | <section xmlns:db="http://docbook.org/docbook-ng" |
|---|
| 3 | | xmlns:xi="http://www.w3.org/2001/XInclude" |
|---|
| 4 | | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 5 | | xml:id="apireference"> |
|---|
| 6 | | <title>API reference</title> |
|---|
| 7 | | <section id="cherrypy"> |
|---|
| 8 | | <title>cherrypy</title> |
|---|
| 9 | | <itemizedlist> |
|---|
| 10 | | <listitem> |
|---|
| | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| | 2 | <section xmlns:db="http://docbook.org/docbook-ng" xmlns:xi="http://www.w3.org/2001/XInclude" |
|---|
| | 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="apireference"> |
|---|
| | 4 | <title>API reference</title> |
|---|
| | 5 | <section id="cherrypy"> |
|---|
| | 6 | <title>cherrypy</title> |
|---|
| | 7 | <itemizedlist> |
|---|
| | 8 | <listitem> |
|---|
| | 9 | <section> |
|---|
| | 10 | <title>cherrypy.threadData</title> |
|---|
| | 11 | <para>This attribute holds attributes that map to this thread only.</para> |
|---|
| | 12 | </section> |
|---|
| | 13 | </listitem> |
|---|
| | 14 | </itemizedlist> |
|---|
| | 15 | </section> |
|---|
| | 16 | <section id="cherrypyrequest"> |
|---|
| | 17 | <title>cherrypy.request</title> |
|---|
| | 18 | <itemizedlist> |
|---|
| | 19 | <listitem> |
|---|
| | 20 | <section> |
|---|
| | 21 | <title>cherrypy.request.remoteAddr</title> |
|---|
| | 22 | <para>This attribute is a string containing the IP address of the client. It will |
|---|
| | 23 | be an empty string if it is not available.</para> |
|---|
| | 24 | </section> |
|---|
| | 25 | </listitem> |
|---|
| | 26 | <listitem> |
|---|
| | 27 | <section> |
|---|
| | 28 | <title>cherrypy.request.remotePort</title> |
|---|
| | 29 | <para>This attribute is an int containing the TCP port number of the client. It |
|---|
| | 30 | will be -1 if it is not available.</para> |
|---|
| | 31 | </section> |
|---|
| | 32 | </listitem> |
|---|
| | 33 | <listitem> |
|---|
| | 34 | <section> |
|---|
| | 35 | <title>cherrypy.request.remoteHost</title> |
|---|
| | 36 | <para>This attribute is a string containing the remote hostname of the |
|---|
| | 37 | client.</para> |
|---|
| | 38 | </section> |
|---|
| | 39 | </listitem> |
|---|
| | 40 | <listitem> |
|---|
| | 41 | <section> |
|---|
| | 42 | <title>cherrypy.request.headerMap</title> |
|---|
| | 43 | <para>This attribute is dictionary containing the received HTTP headers.</para> |
|---|
| | 44 | </section> |
|---|
| | 45 | </listitem> |
|---|
| | 46 | <listitem> |
|---|
| | 47 | <section> |
|---|
| | 48 | <title>cherrypy.request.requestLine</title> |
|---|
| | 49 | <para>This attribute is a string containing the first line of the raw HTTP |
|---|
| | 50 | request.</para> |
|---|
| | 51 | </section> |
|---|
| | 52 | </listitem> |
|---|
| | 53 | <listitem> |
|---|
| | 54 | <section> |
|---|
| | 55 | <title>cherrypy.request.simpleCookie</title> |
|---|
| | 56 | <para>This attribute is a SimpleCookie instance from the standard library's |
|---|
| | 57 | Cookie module which contains the incoming cookie values from the client.</para> |
|---|
| | 58 | </section> |
|---|
| | 59 | </listitem> |
|---|
| | 60 | <listitem> |
|---|
| | 61 | <section> |
|---|
| | 62 | <title>cherrypy.request.rfile</title> |
|---|
| | 63 | <para>This attribute is the input stream to the client. See |
|---|
| | 64 | cherrypy.request.processRequestBody for more information.</para> |
|---|
| | 65 | </section> |
|---|
| | 66 | </listitem> |
|---|
| | 67 | <listitem> |
|---|
| | 68 | <section> |
|---|
| | 69 | <title>cherrypy.request.processRequestBody</title> |
|---|
| | 70 | <para>This attribute should be accessed during the beforeRequestBody stage of the |
|---|
| | 71 | request (if you don't know what this means, read the section on filters). This |
|---|
| | 72 | specifies whether or not the request's POST data will be parsed into the |
|---|
| | 73 | cherrypy.request.paramMap. It defaults to true for POST requests, but when false, |
|---|
| | 74 | cherrypy.request.rfile will be readable by the exposed method. Otherwise, rfile |
|---|
| | 75 | is completely read before control is handled to the exposed method.</para> |
|---|
| | 76 | </section> |
|---|
| | 77 | </listitem> |
|---|
| | 78 | <listitem> |
|---|
| | 79 | <section> |
|---|
| | 80 | <title>cherrypy.request.method</title> |
|---|
| | 81 | <para>This attribute is a string containing the HTTP request method, such as GET |
|---|
| | 82 | or POST.</para> |
|---|
| | 83 | </section> |
|---|
| | 84 | </listitem> |
|---|
| | 85 | <listitem> |
|---|
| | 86 | <section> |
|---|
| | 87 | <title>cherrypy.request.protocol</title> |
|---|
| | 88 | <para>This attribute is a string containing the HTTP protocol of the request in |
|---|
| | 89 | the form of HTTP/x.x</para> |
|---|
| | 90 | </section> |
|---|
| | 91 | </listitem> |
|---|
| | 92 | <listitem> |
|---|
| | 93 | <section> |
|---|
| | 94 | <title>cherrypy.request.queryString</title> |
|---|
| | 95 | <para>This attribute is a string containing the query string of the request (the |
|---|
| | 96 | part of the URL following '?').</para> |
|---|
| | 97 | </section> |
|---|
| | 98 | </listitem> |
|---|
| | 99 | <listitem> |
|---|
| | 100 | <section> |
|---|
| | 101 | <title>cherrypy.request.path</title> |
|---|
| | 102 | <para>This attribute is a string containing the path of the resource the client |
|---|
| | 103 | requested.</para> |
|---|
| | 104 | </section> |
|---|
| | 105 | </listitem> |
|---|
| | 106 | <listitem> |
|---|
| | 107 | <section> |
|---|
| | 108 | <title>cherrypy.request.paramMap</title> |
|---|
| | 109 | <para>This attribute is a dictionary containing the query string and POST |
|---|
| | 110 | arguments of this request.</para> |
|---|
| | 111 | </section> |
|---|
| | 112 | </listitem> |
|---|
| | 113 | <listitem> |
|---|
| | 114 | <section> |
|---|
| | 115 | <title>cherrypy.request.base</title> |
|---|
| | 116 | <para>This attribute is a string containing the root URL of the server.</para> |
|---|
| | 117 | </section> |
|---|
| | 118 | </listitem> |
|---|
| | 119 | <listitem> |
|---|
| | 120 | <section> |
|---|
| | 121 | <title>cherrypy.request.browserUrl</title> |
|---|
| | 122 | <para>This attribute is a string containing the URL the client requested.</para> |
|---|
| | 123 | </section> |
|---|
| | 124 | </listitem> |
|---|
| | 125 | <listitem> |
|---|
| | 126 | <section> |
|---|
| | 127 | <title>cherrypy.request.objectPath</title> |
|---|
| | 128 | <para>This attribute is a string containing the path of the exposed method that |
|---|
| | 129 | will be called to handle this request. This is usually the same as |
|---|
| | 130 | cherrypy.request.path, but can be changed in a filter to change which method is |
|---|
| | 131 | actually called.</para> |
|---|
| | 132 | </section> |
|---|
| | 133 | </listitem> |
|---|
| | 134 | <listitem> |
|---|
| | 135 | <section> |
|---|
| | 136 | <title>cherrypy.request.originalPath</title> |
|---|
| | 137 | <para>This attribute is a string containing the original value of |
|---|
| | 138 | cherrypy.request.path, in case it is modified by a filter during the |
|---|
| | 139 | request.</para> |
|---|
| | 140 | </section> |
|---|
| | 141 | </listitem> |
|---|
| | 142 | <listitem> |
|---|
| | 143 | <section> |
|---|
| | 144 | <title>cherrypy.request.originalParamMap</title> |
|---|
| | 145 | <para>This attribute is a string containing the original value of |
|---|
| | 146 | cherrypy.request.paramMap, in case it is modified by a filter during the |
|---|
| | 147 | request.</para> |
|---|
| | 148 | </section> |
|---|
| | 149 | </listitem> |
|---|
| | 150 | <listitem> |
|---|
| | 151 | <section> |
|---|
| | 152 | <title>cherrypy.request.scheme</title> |
|---|
| | 153 | <para>This attribute is a string containing the URL scheme used in this request. |
|---|
| | 154 | It is either "http" or "https".</para> |
|---|
| | 155 | </section> |
|---|
| | 156 | </listitem> |
|---|
| | 157 | </itemizedlist> |
|---|
| | 158 | </section> |
|---|
| | 159 | <!-- end cherrypy.request section --> |
|---|
| | 160 | <section id="cherrypyresponse"> |
|---|
| | 161 | <title>cherrypy.response</title> |
|---|
| | 162 | <itemizedlist> |
|---|
| | 163 | <listitem> |
|---|
| | 164 | <section> |
|---|
| | 165 | <title>cherrypy.response.headerMap</title> |
|---|
| | 166 | <para>This attribute is a dictionary with automatically titled keys. It holds all |
|---|
| | 167 | outgoing HTTP headers to the client.</para> |
|---|
| | 168 | </section> |
|---|
| | 169 | </listitem> |
|---|
| | 170 | <listitem> |
|---|
| | 171 | <section> |
|---|
| | 172 | <title>cherrypy.response.simpleCookie</title> |
|---|
| | 173 | <para>This attribute is a SimpleCookie instance from the standard library's |
|---|
| | 174 | Cookie module. It contains the outgoing cookie values.</para> |
|---|
| | 175 | </section> |
|---|
| | 176 | </listitem> |
|---|
| | 177 | <listitem> |
|---|
| | 178 | <section> |
|---|
| | 179 | <title>cherrypy.response.body</title> |
|---|
| | 180 | <para>This attribute is originally just the return value of the exposed method, |
|---|
| | 181 | but by the end of the request it must be an iterable (usually a list or generator |
|---|
| | 182 | of strings) which will be the content of the HTTP response.</para> |
|---|
| | 183 | </section> |
|---|
| | 184 | </listitem> |
|---|
| | 185 | <listitem> |
|---|
| | 186 | <section> |
|---|
| | 187 | <title>cherrypy.response.status</title> |
|---|
| | 188 | <para>This attribute is a string containing the HTTP response code in the form |
|---|
| | 189 | "### Reason Phrase", i.e. "200 OK"</para> |
|---|
| | 190 | </section> |
|---|
| | 191 | </listitem> |
|---|
| | 192 | </itemizedlist> |
|---|
| | 193 | </section> |
|---|
| | 194 | <section id="cherrypyserver"> |
|---|
| | 195 | <title>cherrypy.server</title> |
|---|
| | 196 | <itemizedlist> |
|---|
| | 197 | <listitem> |
|---|
| | 198 | <section> |
|---|
| | 199 | <title>cherrypy.server.start()</title> |
|---|
| | 200 | <para>Start the CherryPy Server.</para> |
|---|
| | 201 | </section> |
|---|
| | 202 | </listitem> |
|---|
| | 203 | <listitem> |
|---|
| | 204 | <section> |
|---|
| | 205 | <title>cherrypy.server.stop()</title> |
|---|
| | 206 | <para>Stop the CherryPy Server.</para> |
|---|
| | 207 | </section> |
|---|
| | 208 | </listitem> |
|---|
| | 209 | <listitem> |
|---|
| | 210 | <section> |
|---|
| | 211 | <title>cherrypy.server.restart()</title> |
|---|
| | 212 | <para>Restart the CherryPy Server.</para> |
|---|
| | 213 | </section> |
|---|
| | 214 | </listitem> |
|---|
| | 215 | <listitem> |
|---|
| | 216 | <section> |
|---|
| | 217 | <title>cherrypy.server.onStartServerList</title> |
|---|
| | 218 | <para>A list of functions that will be called when the server starts.</para> |
|---|
| | 219 | </section> |
|---|
| | 220 | </listitem> |
|---|
| | 221 | <listitem> |
|---|
| | 222 | <section> |
|---|
| | 223 | <title>cherrypy.server.onStopServerList</title> |
|---|
| | 224 | <para>A list of functions that will be called when the server stops.</para> |
|---|
| | 225 | </section> |
|---|
| | 226 | </listitem> |
|---|
| | 227 | <listitem> |
|---|
| | 228 | <section> |
|---|
| | 229 | <title>cherrypy.server.onStartThreadList</title> |
|---|
| | 230 | <para>A list of functions that will be called when each thread is started.</para> |
|---|
| | 231 | </section> |
|---|
| | 232 | </listitem> |
|---|
| | 233 | <listitem> |
|---|
| | 234 | <section> |
|---|
| | 235 | <title>cherrypy.server.onStopThreadList</title> |
|---|
| | 236 | <para>A list of functions that will be called when each thread is stopped.</para> |
|---|
| | 237 | </section> |
|---|
| | 238 | </listitem> |
|---|
| | 239 | </itemizedlist> |
|---|
| | 240 | </section> |
|---|
| | 241 | <!-- end cherrypyserver section --> |
|---|
| | 242 | <section id="cherrypyconfig"> |
|---|
| | 243 | <title>cherrypy.config</title> |
|---|
| | 244 | <itemizedlist> |
|---|
| | 245 | <listitem> |
|---|
| | 246 | <section> |
|---|
| | 247 | <title>cherrypy.config.get(key, defaultValue = None, returnSection = |
|---|
| | 248 | False)</title> |
|---|
| | 249 | <para>This function returns the configuration value for the given key. The |
|---|
| | 250 | function checks if the setting is defined for the current request path, it walks |
|---|
| | 251 | up the request path until the key is found, or it returns the default value. If |
|---|
| | 252 | returnSection is True, the function returns the configuration path where the key |
|---|
| | 253 | is defined.</para> |
|---|
| | 254 | </section> |
|---|
| | 255 | </listitem> |
|---|
| | 256 | <listitem> |
|---|
| | 257 | <section> |
|---|
| | 258 | <title>cherrypy.config.getAll(key)</title> |
|---|
| | 259 | <para>The getAll function returns a list containing a (path, value) tuple for all |
|---|
| | 260 | occurences of the key within the request path. This function allows applications |
|---|
| | 261 | to inherit configuration data defined for parent paths.</para> |
|---|
| | 262 | </section> |
|---|
| | 263 | </listitem> |
|---|
| | 264 | <listitem> |
|---|
| | 265 | <section> |
|---|
| | 266 | <title>cherrypy.config.update(updateMap=None, file=None)</title> |
|---|
| | 267 | <para>Function to update the configuration map. upDateMap is a dictionary of the |
|---|
| | 268 | form {'sectionPath' : { } }, file is the path to the configuration file.</para> |
|---|
| | 269 | </section> |
|---|
| | 270 | </listitem> |
|---|
| | 271 | </itemizedlist> |
|---|
| | 272 | </section> |
|---|
| | 273 | <section id="exceptions"> |
|---|
| | 274 | <title>cherrypy exceptions</title> |
|---|
| | 275 | <itemizedlist> |
|---|
| | 276 | <listitem> |
|---|
| | 277 | <section> |
|---|
| | 278 | <title>cherrypy.HTTPError</title> |
|---|
| | 279 | <para>This exception can be used to automatically send a response using a http |
|---|
| | 280 | status code, with an appropriate error page.</para> |
|---|
| | 281 | </section> |
|---|
| | 282 | </listitem> |
|---|
| | 283 | <listitem> |
|---|
| | 284 | <section><title>cherrypy.HTTPRedirect</title> This exception will force a HTTP |
|---|
| | 285 | redirect.</section> |
|---|
| | 286 | </listitem> |
|---|
| | 287 | <listitem> |
|---|
| | 288 | <section><title>cherrypy.NotFound</title> This exception is raised when CherryPy is |
|---|
| | 289 | unable to map a requested path to an internal method.</section> |
|---|
| | 290 | </listitem> |
|---|
| | 291 | </itemizedlist> |
|---|
| | 292 | </section> |
|---|
| | 293 | <section id="lib"> |
|---|
| | 294 | <title>CherryPy included library functions</title> |
|---|
| 15 | | </listitem> |
|---|
| 16 | | </itemizedlist> |
|---|
| 17 | | </section> |
|---|
| 18 | | <section id="cherrypyrequest"> |
|---|
| 19 | | <title>cherrypy.request</title> |
|---|
| 20 | | <itemizedlist> |
|---|
| 21 | | <listitem> |
|---|
| 22 | | <section> |
|---|
| 23 | | <title>cherrypy.request.remoteAddr</title> |
|---|
| 24 | | <para>This attribute is a string containing the IP address of the |
|---|
| 25 | | client. It will be an empty string if it is not available.</para> |
|---|
| 26 | | </section> |
|---|
| 27 | | </listitem> |
|---|
| 28 | | <listitem> |
|---|
| 29 | | <section> |
|---|
| 30 | | <title>cherrypy.request.remotePort</title> |
|---|
| 31 | | <para>This attribute is an int containing the TCP port number of |
|---|
| 32 | | the client. It will be -1 if it is not available.</para> |
|---|
| 33 | | </section> |
|---|
| 34 | | </listitem> |
|---|
| 35 | | <listitem> |
|---|
| 36 | | <section> |
|---|
| 37 | | <title>cherrypy.request.remoteHost</title> |
|---|
| 38 | | <para>This attribute is a string containing the remote hostname of the client.</para> |
|---|
| 39 | | </section> |
|---|
| 40 | | </listitem> |
|---|
| 41 | | <listitem> |
|---|
| 42 | | <section> |
|---|
| 43 | | <title>cherrypy.request.headerMap</title> |
|---|
| 44 | | <para>This attribute is dictionary containing the received HTTP headers.</para> |
|---|
| 45 | | </section> |
|---|
| 46 | | </listitem> |
|---|
| 47 | | <listitem> |
|---|
| 48 | | <section> |
|---|
| 49 | | <title>cherrypy.request.requestLine</title> |
|---|
| 50 | | <para>This attribute is a string containing the first line of the raw HTTP request.</para> |
|---|
| 51 | | </section> |
|---|
| 52 | | </listitem> |
|---|
| 53 | | <listitem> |
|---|
| 54 | | <section> |
|---|
| 55 | | <title>cherrypy.request.simpleCookie</title> |
|---|
| 56 | | <para>This attribute is a SimpleCookie instance from the standard library's Cookie module |
|---|
| 57 | | which contains the incoming cookie values from the client.</para> |
|---|
| 58 | | </section> |
|---|
| 59 | | </listitem> |
|---|
| 60 | | <listitem> |
|---|
| 61 | | <section> |
|---|
| 62 | | <title>cherrypy.request.remoteAddr</title> |
|---|
| 63 | | <para>This attribute is a string containing the IP address of the client.</para> |
|---|
| 64 | | </section> |
|---|
| 65 | | </listitem> |
|---|
| 66 | | <listitem> |
|---|
| 67 | | <section> |
|---|
| 68 | | <title>cherrypy.request.rfile</title> |
|---|
| 69 | | <para>This attribute is the input stream to the client. See cherrypy.request.processRequestBody |
|---|
| 70 | | for more information.</para> |
|---|
| 71 | | </section> |
|---|
| 72 | | </listitem> |
|---|
| 73 | | <listitem> |
|---|
| 74 | | <section> |
|---|
| 75 | | <title>cherrypy.request.processRequestBody</title> |
|---|
| 76 | | <para>This attribute should be accessed during the beforeRequestBody stage of the request |
|---|
| 77 | | (if you don't know what this means, read the section on filters). This specifies whether |
|---|
| 78 | | or not the request's POST data will be parsed into the cherrypy.request.paramMap. |
|---|
| 79 | | It defaults to true for POST requests, but when false, cherrypy.request.rfile will be readable by |
|---|
| 80 | | the exposed method. Otherwise, rfile is completely read before control is handled to the |
|---|
| 81 | | exposed method.</para> |
|---|
| 82 | | </section> |
|---|
| 83 | | </listitem> |
|---|
| 84 | | <listitem> |
|---|
| 85 | | <section> |
|---|
| 86 | | <title>cherrypy.request.method</title> |
|---|
| 87 | | <para>This attribute is a string containing the HTTP request method, such as GET or POST.</para> |
|---|
| 88 | | </section> |
|---|
| 89 | | </listitem> |
|---|
| 90 | | <listitem> |
|---|
| 91 | | <section> |
|---|
| 92 | | <title>cherrypy.request.protocol</title> |
|---|
| 93 | | <para>This attribute is a string containing the HTTP protocol of the request in the form of |
|---|
| 94 | | HTTP/x.x</para> |
|---|
| 95 | | </section> |
|---|
| 96 | | </listitem> |
|---|
| 97 | | <listitem> |
|---|
| 98 | | <section> |
|---|
| 99 | | <title>cherrypy.request.queryString</title> |
|---|
| 100 | | <para>This attribute is a string containing the query string of the request (the part |
|---|
| 101 | | of the URL following '?').</para> |
|---|
| 102 | | </section> |
|---|
| 103 | | </listitem> |
|---|
| 104 | | <listitem> |
|---|
| 105 | | <section> |
|---|
| 106 | | <title>cherrypy.request.path</title> |
|---|
| 107 | | <para>This attribute is a string containing the path of the resource the client requested.</para> |
|---|
| 108 | | </section> |
|---|
| 109 | | </listitem> |
|---|
| 110 | | <listitem> |
|---|
| 111 | | <section> |
|---|
| 112 | | <title>cherrypy.request.paramMap</title> |
|---|
| 113 | | <para>This attribute is a dictionary containing the query string and POST arguments |
|---|
| 114 | | of this request.</para> |
|---|
| 115 | | </section> |
|---|
| 116 | | </listitem> |
|---|
| 117 | | <listitem> |
|---|
| 118 | | <section> |
|---|
| 119 | | <title>cherrypy.request.base</title> |
|---|
| 120 | | <para>This attribute is a string containing the root URL of the server.</para> |
|---|
| 121 | | </section> |
|---|
| 122 | | </listitem> |
|---|
| 123 | | <listitem> |
|---|
| 124 | | <section> |
|---|
| 125 | | <title>cherrypy.request.browserUrl</title> |
|---|
| 126 | | <para>This attribute is a string containing the URL the client requested.</para> |
|---|
| 127 | | </section> |
|---|
| 128 | | </listitem> |
|---|
| 129 | | <listitem> |
|---|
| 130 | | <section> |
|---|
| 131 | | <title>cherrypy.request.objectPath</title> |
|---|
| 132 | | <para>This attribute is a string containing the path of the exposed method that will |
|---|
| 133 | | be called to handle this request. This is usually the same as cherrypy.request.path, but |
|---|
| 134 | | can be changed in a filter to change which method is actually called.</para> |
|---|
| 135 | | </section> |
|---|
| 136 | | </listitem> |
|---|
| 137 | | <listitem> |
|---|
| 138 | | <section> |
|---|
| 139 | | <title>cherrypy.request.originalPath</title> |
|---|
| 140 | | <para>This attribute is a string containing the original value of cherrypy.request.path, |
|---|
| 141 | | in case it is modified by a filter during the request.</para> |
|---|
| 142 | | </section> |
|---|
| 143 | | </listitem> |
|---|
| 144 | | <listitem> |
|---|
| 145 | | <section> |
|---|
| 146 | | <title>cherrypy.request.originalParamMap</title> |
|---|
| 147 | | <para>This attribute is a string containing the original value of cherrypy.request.paramMap, |
|---|
| 148 | | in case it is modified by a filter during the request.</para> |
|---|
| 149 | | </section> |
|---|
| 150 | | </listitem> |
|---|
| 151 | | <listitem> |
|---|
| 152 | | <section> |
|---|
| 153 | | <title>cherrypy.request.scheme</title> |
|---|
| 154 | | <para>This attribute is a string containing the URL scheme used in this request. It |
|---|
| 155 | | is either "http" or "https".</para> |
|---|
| 156 | | </section> |
|---|
| 157 | | </listitem> |
|---|
| 158 | | </itemizedlist> |
|---|
| 159 | | </section> <!-- end cherrypy.request section --> |
|---|
| 160 | | |
|---|
| 161 | | <section id="cherrypyresponse"> |
|---|
| 162 | | <title>cherrypy.response</title> |
|---|
| 163 | | <itemizedlist> |
|---|
| 164 | | <listitem> |
|---|
| 165 | | <section> |
|---|
| 166 | | <title>cherrypy.response.headerMap</title> |
|---|
| 167 | | <para>This attribute is a dictionary with automatically titled keys. It holds all outgoing |
|---|
| 168 | | HTTP headers to the client.</para> |
|---|
| 169 | | </section> |
|---|
| 170 | | </listitem> |
|---|
| 171 | | <listitem> |
|---|
| 172 | | <section> |
|---|
| 173 | | <title>cherrypy.response.simpleCookie</title> |
|---|
| 174 | | <para>This attribute is a SimpleCookie instance from the standard library's Cookie module. It |
|---|
| 175 | | contains the outgoing cookie values.</para> |
|---|
| 176 | | </section> |
|---|
| 177 | | </listitem> |
|---|
| 178 | | <listitem> |
|---|
| 179 | | <section> |
|---|
| 180 | | <title>cherrypy.response.body</title> |
|---|
| 181 | | <para>This attribute is originally just the return value of the exposed method, but by the end of the |
|---|
| 182 | | request it must be an iterable (usually a list or generator of strings) which will be the |
|---|
| 183 | | content of the HTTP response.</para> |
|---|
| 184 | | </section> |
|---|
| 185 | | </listitem> |
|---|
| 186 | | <listitem> |
|---|
| 187 | | <section> |
|---|
| 188 | | <title>cherrypy.response.status</title> |
|---|
| 189 | | <para>This attribute is a string containing the HTTP response code in the form "### Reason Phrase", |
|---|
| 190 | | i.e. "200 OK"</para> |
|---|
| 191 | | </section> |
|---|
| 192 | | </listitem> |
|---|
| 193 | | </itemizedlist> |
|---|
| 194 | | </section> |
|---|
| 195 | | |
|---|
| 196 | | <section id="cherrypyserver"> |
|---|
| 197 | | <title>cherrypy.server</title> |
|---|
| 198 | | <itemizedlist> |
|---|
| 199 | | <listitem> |
|---|
| 200 | | <section> |
|---|
| 201 | | <title>cherrypy.server.start()</title> |
|---|
| 202 | | <para> |
|---|
| 203 | | Start the CherryPy Server. |
|---|
| 204 | | </para> |
|---|
| 205 | | </section> |
|---|
| 206 | | </listitem> |
|---|
| 207 | | <listitem> |
|---|
| 208 | | <section> |
|---|
| 209 | | <title>cherrypy.server.stop()</title> |
|---|
| 210 | | <para> |
|---|
| 211 | | Stop the CherryPy Server. |
|---|
| 212 | | </para> |
|---|
| 213 | | </section> |
|---|
| 214 | | </listitem> |
|---|
| 215 | | <listitem> |
|---|
| 216 | | <section> |
|---|
| 217 | | <title>cherrypy.server.restart()</title> |
|---|
| 218 | | <para> |
|---|
| 219 | | Restart the CherryPy Server. |
|---|
| 220 | | </para> |
|---|
| 221 | | </section> |
|---|
| 222 | | </listitem> |
|---|
| 223 | | <listitem> |
|---|
| 224 | | <section> |
|---|
| 225 | | <title>cherrypy.server.onStartServerList</title> |
|---|
| 226 | | <para> |
|---|
| 227 | | A list of functions that will be called when the server starts. |
|---|
| 228 | | </para> |
|---|
| 229 | | </section> |
|---|
| 230 | | </listitem> |
|---|
| 231 | | <listitem> |
|---|
| 232 | | <section> |
|---|
| 233 | | <title>cherrypy.server.onStopServerList</title> |
|---|
| 234 | | <para> |
|---|
| 235 | | A list of functions that will be called when the server stops. |
|---|
| 236 | | </para> |
|---|
| 237 | | </section> |
|---|
| 238 | | </listitem> |
|---|
| 239 | | <listitem> |
|---|
| 240 | | <section> |
|---|
| 241 | | <title>cherrypy.server.onStartThreadList</title> |
|---|
| 242 | | <para> |
|---|
| 243 | | A list of functions that will be called when each thread is started. |
|---|
| 244 | | </para> |
|---|
| 245 | | </section> |
|---|
| 246 | | </listitem> |
|---|
| 247 | | <listitem> |
|---|
| 248 | | <section> |
|---|
| 249 | | <title>cherrypy.server.onStopThreadList</title> |
|---|
| 250 | | <para> |
|---|
| 251 | | A list of functions that will be called when each thread is stopped. |
|---|
| 252 | | </para> |
|---|
| 253 | | </section> |
|---|
| 254 | | </listitem> |
|---|
| 255 | | </itemizedlist> |
|---|
| 256 | | </section> <!-- end cherrypyserver section --> |
|---|
| 257 | | |
|---|
| 258 | | <section id="cherrypyconfig"> |
|---|
| 259 | | <title>cherrypy.config</title> |
|---|
| 260 | | <itemizedlist> |
|---|
| 261 | | <listitem> |
|---|
| 262 | | <section> |
|---|
| 263 | | <title>cherrypy.config.get(key, defaultValue = None, returnSection = False)</title> |
|---|
| 264 | | <para> |
|---|
| 265 | | This function returns the configuration value for the given key. The function |
|---|
| 266 | | checks if the setting is defined for the current request path, it walks up the |
|---|
| 267 | | request path until the key is found, or it returns the default value. If |
|---|
| 268 | | returnSection is True, the function returns the configuration path where the key |
|---|
| 269 | | is defined. |
|---|
| 270 | | </para> |
|---|
| 271 | | </section> |
|---|
| 272 | | </listitem> |
|---|
| 273 | | <listitem> |
|---|
| 274 | | <section> |
|---|
| 275 | | <title>cherrypy.config.getAll(key)</title> |
|---|
| 276 | | <para> |
|---|
| 277 | | The getAll function returns a list containing a (path, value) tuple for all occurences |
|---|
| 278 | | of the key within the request path. This function allows applications to inherit |
|---|
| 279 | | configuration data defined for parent paths. |
|---|
| 280 | | </para> |
|---|
| 281 | | </section> |
|---|
| 282 | | </listitem> |
|---|
| 283 | | <listitem> |
|---|
| 284 | | <section> |
|---|
| 285 | | <title>cherrypy.config.update(updateMap=None, file=None)</title> |
|---|
| 286 | | <para> |
|---|
| 287 | | Function to update the configuration map. upDateMap is a dictionary of the form |
|---|
| 288 | | {'sectionPath' : { } }, file is the path to the configuration file. |
|---|
| 289 | | </para> |
|---|
| 290 | | </section> |
|---|
| 291 | | </listitem> |
|---|
| 292 | | </itemizedlist> |
|---|
| 293 | | </section> |
|---|
| 294 | | |
|---|
| 295 | | <section id="exceptions"> |
|---|
| 296 | | <title>cherrypy exceptions</title> |
|---|
| 297 | | <itemizedlist> |
|---|
| 298 | | |
|---|
| 299 | | <listitem> |
|---|
| 300 | | <section> |
|---|
| 301 | | <title>cherrypy.HTTPError</title> |
|---|
| 302 | | <para> |
|---|
| 303 | | This exception can be used to automatically send a response |
|---|
| 304 | | using a http status code, with an appropriate error page. |
|---|
| 305 | | </para> |
|---|
| 306 | | </section> |
|---|
| 307 | | </listitem> |
|---|
| 308 | | |
|---|
| 309 | | <listitem> |
|---|
| 310 | | <section> |
|---|
| 311 | | <title>cherrypy.HTTPRedirect</title> |
|---|
| 312 | | This exception will force a HTTP redirect. |
|---|
| 313 | | </section> |
|---|
| 314 | | </listitem> |
|---|
| 315 | | |
|---|
| 316 | | <listitem> |
|---|
| 317 | | <section> |
|---|
| 318 | | <title>cherrypy.NotFound</title> |
|---|
| 319 | | This exception is raised when CherryPy is unable to map a |
|---|
| 320 | | requested path to an internal method. |
|---|
| 321 | | </section> |
|---|
| 322 | | </listitem> |
|---|
| 323 | | |
|---|
| 324 | | </itemizedlist> |
|---|
| 325 | | </section> |
|---|
| 326 | | |
|---|
| 327 | | <section id="lib"> |
|---|
| 328 | | <title>CherryPy included library functions</title> |
|---|
| 329 | | <section> |
|---|
| 330 | | <title>cherrypy.lib.cptools</title> |
|---|
| 331 | | <itemizedlist> |
|---|
| 332 | | <section> |
|---|
| 333 | | <title>ExposeItems</title> |
|---|
| 334 | | </section> |
|---|
| 335 | | <section> |
|---|
| 336 | | <title>PositionalParametersAware</title> |
|---|
| 337 | | </section> |
|---|
| 338 | | </itemizedlist> |
|---|
| 339 | | </section> |
|---|
| 340 | | </section> |
|---|
| 341 | | |
|---|
| 342 | | <section id="specialfunctions"> |
|---|
| 343 | | <title>Special functions and attributes</title> |
|---|
| 344 | | <itemizedlist> |
|---|
| 345 | | <listitem> |
|---|
| 346 | | <section> |
|---|
| 347 | | <title>_cpOnError</title> |
|---|
| 348 | | <para> |
|---|
| 349 | | _cpOnError is a function for handling internal exceptions raised by CherryPy. |
|---|
| 350 | | </para> |
|---|
| 351 | | </section> |
|---|
| 352 | | </listitem> |
|---|
| 353 | | <listitem> |
|---|
| 354 | | <section> |
|---|
| 355 | | <title>_cpFilterList</title> |
|---|
| 356 | | <para> |
|---|
| 357 | | User defined filters are enabled using the class attribute _cpFilterList. |
|---|
| 358 | | Any filter instances placed in _cpFilterList will be applied to all methods |
|---|
| 359 | | of the class. |
|---|
| 360 | | </para> |
|---|
| 361 | | </section> |
|---|
| 362 | | </listitem> |
|---|
| 363 | | </itemizedlist> |
|---|
| 364 | | </section> |
|---|
| 365 | | |
|---|
| 366 | | <section id="filters"> |
|---|
| 367 | | <title>Filter API</title> |
|---|
| 368 | | <itemizedlist> |
|---|
| 369 | | <listitem> |
|---|
| 370 | | <section> |
|---|
| 371 | | <title>onStartResource</title> |
|---|
| 372 | | </section> |
|---|
| 373 | | </listitem> |
|---|
| 374 | | <listitem> |
|---|
| 375 | | <section> |
|---|
| 376 | | <title>beforeRequestBody</title> |
|---|
| 377 | | </section> |
|---|
| 378 | | </listitem> |
|---|
| 379 | | <listitem> |
|---|
| 380 | | <section> |
|---|
| 381 | | <title>beforeMain</title> |
|---|
| 382 | | </section> |
|---|
| 383 | | </listitem> |
|---|
| 384 | | <listitem> |
|---|
| 385 | | <section> |
|---|
| 386 | | <title>beforeFinalize</title> |
|---|
| 387 | | </section> |
|---|
| 388 | | </listitem> |
|---|
| 389 | | <listitem> |
|---|
| 390 | | <section> |
|---|
| 391 | | <title>onEndResource</title> |
|---|
| 392 | | </section> |
|---|
| 393 | | </listitem> |
|---|
| 394 | | <listitem> |
|---|
| 395 | | <section> |
|---|
| 396 | | <title>beforeErrorResponse</title> |
|---|
| 397 | | </section> |
|---|
| 398 | | </listitem> |
|---|
| 399 | | <listitem> |
|---|
| 400 | | <section> |
|---|
| 401 | | <title>afterErrorResponse</title> |
|---|
| 402 | | </section> |
|---|
| 403 | | </listitem> |
|---|
| 404 | | </itemizedlist> |
|---|
| 405 | | </section> |
|---|
| 406 | | |
|---|
| | 306 | </section> |
|---|
| | 307 | <section id="specialfunctions"> |
|---|
| | 308 | <title>Special functions and attributes</title> |
|---|
| | 309 | <itemizedlist> |
|---|
| | 310 | <listitem> |
|---|
| | 311 | <section> |
|---|
| | 312 | <title>_cpOnError</title> |
|---|
| | 313 | <para>_cpOnError is a function for handling internal exceptions raised by |
|---|
| | 314 | CherryPy.</para> |
|---|
| | 315 | </section> |
|---|
| | 316 | </listitem> |
|---|
| | 317 | <listitem> |
|---|
| | 318 | <section> |
|---|
| | 319 | <title>_cpFilterList</title> |
|---|
| | 320 | <para>User defined filters are enabled using the class attribute _cpFilterList. |
|---|
| | 321 | Any filter instances placed in _cpFilterList will be applied to all methods of |
|---|
| | 322 | the class.</para> |
|---|
| | 323 | </section> |
|---|
| | 324 | </listitem> |
|---|
| | 325 | </itemizedlist> |
|---|
| | 326 | </section> |
|---|
| | 327 | <section id="filters"> |
|---|
| | 328 | <title>Filter API</title> |
|---|
| | 329 | <itemizedlist> |
|---|
| | 330 | <listitem> |
|---|
| | 331 | <section> |
|---|
| | 332 | <title>onStartResource</title> |
|---|
| | 333 | </section> |
|---|
| | 334 | </listitem> |
|---|
| | 335 | <listitem> |
|---|
| | 336 | <section> |
|---|
| | 337 | <title>beforeRequestBody</title> |
|---|
| | 338 | </section> |
|---|
| | 339 | </listitem> |
|---|
| | 340 | <listitem> |
|---|
| | 341 | <section> |
|---|
| | 342 | <title>beforeMain</title> |
|---|
| | 343 | </section> |
|---|
| | 344 | </listitem> |
|---|
| | 345 | <listitem> |
|---|
| | 346 | <section> |
|---|
| | 347 | <title>beforeFinalize</title> |
|---|
| | 348 | </section> |
|---|
| | 349 | </listitem> |
|---|
| | 350 | <listitem> |
|---|
| | 351 | <section> |
|---|
| | 352 | <title>onEndResource</title> |
|---|
| | 353 | </section> |
|---|
| | 354 | </listitem> |
|---|
| | 355 | <listitem> |
|---|
| | 356 | <section> |
|---|
| | 357 | <title>beforeErrorResponse</title> |
|---|
| | 358 | </section> |
|---|
| | 359 | </listitem> |
|---|
| | 360 | <listitem> |
|---|
| | 361 | <section> |
|---|
| | 362 | <title>afterErrorResponse</title> |
|---|
| | 363 | </section> |
|---|
| | 364 | </listitem> |
|---|
| | 365 | </itemizedlist> |
|---|
| | 366 | </section> |
|---|