Logo Search packages:      
Sourcecode: paste version File versions  Download package

paste::httpexceptions::HTTPException Class Reference

Inheritance diagram for paste::httpexceptions::HTTPException:

paste::httpexceptions::HTTPError paste::httpexceptions::HTTPRedirection paste::httpexceptions::HTTPClientError paste::httpexceptions::HTTPServerError paste::httpexceptions::_HTTPMove paste::auth::cas::CASLoginFailure paste::auth::cas::CASAuthenticate

List of all members.


Detailed Description

the HTTP exception base class

This encapsulates an HTTP response that interrupts normal application
flow; but one which is not necessarly an error condition. For
example, codes in the 300's are exceptions in that they interrupt
normal processing; however, they are not considered errors.

This class is complicated by 4 factors:

  1. The content given to the exception may either be plain-text or
     as html-text.

  2. The template may want to have string-substitutions taken from
     the current ``environ`` or values from incoming headers. This
     is especially troublesome due to case sensitivity.

  3. The final output may either be text/plain or text/html
     mime-type as requested by the client application.

  4. Each exception has a default explanation, but those who
     raise exceptions may want to provide additional detail.

Attributes:

   ``code``
       the HTTP status code for the exception

   ``title``
       remainder of the status line (stuff after the code)

   ``explanation``
       a plain-text explanation of the error message that is
       not subject to environment or header substitutions;
       it is accessible in the template via %(explanation)s

   ``detail``
       a plain-text message customization that is not subject
       to environment or header substitutions; accessible in
       the template via %(detail)s

   ``template``
       a content fragment (in HTML) used for environment and
       header substitution; the default template includes both
       the explanation and further detail provided in the
       message

   ``required_headers``
       a sequence of headers which are required for proper
       construction of the exception

Parameters:

   ``detail``
     a plain-text override of the default ``detail``

   ``headers``
     a list of (k,v) header pairs

   ``comment``
     a plain-text additional information which is
     usually stripped/hidden for end-users

To override the template (which is HTML content) or the plain-text
explanation, one must subclass the given exception; or customize it
after it has been created.  This particular breakdown of a message
into explanation, detail and template allows both the creation of
plain-text and html messages for various clients as well as
error-free substitution of environment variables and headers.

Definition at line 95 of file httpexceptions.py.


Public Member Functions

def __init__
def __repr__
def html
def make_body
def plain
def wsgi_application

Public Attributes

 comment
 detail
 headers

Static Public Attributes

 code = None
string comment = ''
string detail = ''
string explanation = ''
tuple required_headers = ()
string template = "%(explanation)s\r\n<br/>%(detail)s\r\n<!-- %(comment)s -->"
 title = None

Static Private Attributes

 __call__ = wsgi_application

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index