Package cherrypy :: Module _cperror
[hide private]
[frames] | no frames]

Module _cperror

source code

Error classes for CherryPy.

Classes [hide private]
  CherryPyException
  InternalRedirect
Exception raised to switch to the handler for a different URL.
  HTTPRedirect
Exception raised when the request should be redirected.
  HTTPError
Exception used to return an HTTP error code (4xx-5xx) to the client.
  NotFound
Exception raised when a URL could not be mapped to any handler (404).
  TimeoutError
Exception raised when Response.timed_out is detected.
Functions [hide private]
 
get_error_page(status, **kwargs)
Return an HTML page, containing a pretty error response.
source code
 
_be_ie_unfriendly(status) source code
 
format_exc(exc=None)
Return exc (or sys.exc_info if None), formatted.
source code
 
bare_error(extrabody=None)
Produce status, headers, body for a critical error.
source code
Variables [hide private]
  _HTTPErrorTemplate = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
  _ie_friendly_error_sizes = {400: 512, 403: 256, 404: 512, 405:...
Function Details [hide private]

get_error_page(status, **kwargs)

source code 

Return an HTML page, containing a pretty error response.

status should be an int or a str. kwargs will be interpolated into the page template.

bare_error(extrabody=None)

source code 

Produce status, headers, body for a critical error.

Returns a triple without calling any other questionable functions, so it should be as error-free as possible. Call it from an HTTP server if you get errors outside of the request.

If extrabody is None, a friendly but rather unhelpful error message is set in the body. If extrabody is a string, it will be appended as-is to the body.

Variables Details [hide private]

_HTTPErrorTemplate

Value:
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htt\
p://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"\
></meta>
    <title>%(status)s</title>
    <style type="text/css">
...

_ie_friendly_error_sizes

Value:
{400: 512,
 403: 256,
 404: 512,
 405: 256,
 406: 512,
 408: 512,
 409: 512,
 410: 256,
...