WebKit.HTTPExceptions | index /usr/local/share/webware/WebKit/HTTPExceptions.py

`HTTPExceptions
HTTPExceptions are for situations that are predicted by the
HTTP spec. Where the ``200 OK`` response is typical, a
``404 Not Found`` or ``301 Moved Temporarily`` response is not
entirely unexpected.
`Application` catches all `HTTPException` exceptions (and subclasses
of HTTPException), and instead of being errors these are translated
into responses. In various places these can also be caught and
changed, for instance an `HTTPAuthenticationRequired` could be
turned into a normal login page.`

Classes

``

exceptions.Exception
  HTTPException
    HTTPAuthenticationRequired
    HTTPAuthenticationRequired
    HTTPBadRequest
    HTTPConflict
    HTTPForbidden
    HTTPInsufficientStorage
    HTTPMethodNotAllowed
    HTTPMovedPermanently
      HTTPTemporaryRedirect
      HTTPTemporaryRedirect
    HTTPNotFound
    HTTPNotImplemented
    HTTPPreconditionFailed
    HTTPUnsupportedMediaType

class HTTPAuthenticationRequired(HTTPException)

``

`HTTPExcecption "authentication required" subclass.
HTTPAuthenticationRequired will usually cause the browser to open up an
HTTP login box, and after getting login information from the user, the
browser will resubmit the request. However, this should also trigger
login pages in properly set up environments (though much code will not
work this way).
Browsers will usually not send authentication information unless they
receive this response, even when other pages on the site have given 401
responses before. So when using this authentication every request will
usually be doubled, once without authentication, once with.
`

Method resolution order:
  HTTPAuthenticationRequired
  HTTPException
  exceptions.Exception

Methods defined here:

__init__(self, realm=None, *args)

headers(self)

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__str__(...)

HTTPAuthorizationRequired = class HTTPAuthenticationRequired(HTTPException)

``

`HTTPExcecption "authentication required" subclass.
HTTPAuthenticationRequired will usually cause the browser to open up an
HTTP login box, and after getting login information from the user, the
browser will resubmit the request. However, this should also trigger
login pages in properly set up environments (though much code will not
work this way).
Browsers will usually not send authentication information unless they
receive this response, even when other pages on the site have given 401
responses before. So when using this authentication every request will
usually be doubled, once without authentication, once with.
`

Method resolution order:
  HTTPAuthenticationRequired
  HTTPException
  exceptions.Exception

Methods defined here:

__init__(self, realm=None, *args)

headers(self)

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__str__(...)

class HTTPBadRequest(HTTPException)
`` | `HTTPExcecption "bad request" subclass. When the browser sends an invalid request.`

Method resolution order:
  HTTPBadRequest
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPConflict(HTTPException)
`` | `HTTPExcecption "conflict" subclass. When there's a locking conflict on this resource (in response to something like a PUT, not for most other conflicts). Mostly for WebDAV.`

Method resolution order:
  HTTPConflict
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPException(exceptions.Exception)
`` | `HTTPException template class. Subclasses must define these variables (usually as class variables): `_code`: a tuple of the integer error code, and the short description that goes with it (like ``(200, "OK")``) `_description`: the long-winded description, to be presented in the response page. Or you can override description() if you want something more context-sensitive.`

Methods defined here:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPForbidden(HTTPException)

``

`HTTPExcecption "forbidden" subclass.
When access is not allowed to this resource. If the user is anonymous,
and must be authenticated, then HTTPAuthenticationRequired is a preferable
exception. If the user should not be able to get to this resource (at
least through the path they did), or is authenticated and still doesn't
have access, or no one is allowed to view this, then HTTPForbidden would
be the proper response.
`

Method resolution order:
  HTTPForbidden
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPInsufficientStorage(HTTPException)
`` | `HTTPExcecption "insufficient storage" subclass. When there is not sufficient storage, usually in response to a PUT when there isn't enough disk space. Mostly for WebDAV.`

Method resolution order:
  HTTPInsufficientStorage
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPMethodNotAllowed(HTTPException)
`` | `HTTPExcecption "method not allowed" subclass. When a method (like GET, PROPFIND, POST, etc) is not allowed on this resource (usually because it does not make sense, not because it is not permitted). Mostly for WebDAV.`

Method resolution order:
  HTTPMethodNotAllowed
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPMovedPermanently(HTTPException)
`` | `HTTPExcecption "moved permanently" subclass. When a resource is permanently moved. The browser may remember this relocation, and later requests may skip requesting the original resource altogether.`

Method resolution order:
  HTTPMovedPermanently
  HTTPException
  exceptions.Exception

Methods defined here:

__init__(self, location=None, webkitLocation=None, *args)
  `Set destination.
  HTTPMovedPermanently needs a destination that you it should be
  directed to -- you can pass `location` *or* `webkitLocation` --
  if you pass `webkitLocation` it will be relative to the WebKit base
  (the portion through the adapter).`

description(self)

headers(self)
  `We include a Location header.`

location(self)
  `The location that we will be redirecting to.`

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__str__(...)

class HTTPNotFound(HTTPException)
`` | `HTTPExcecption "not found" subclass. When the requested resource does not exist. To be more secretive, it is okay to return a 404 if access to the resource is not permitted (you are not required to use HTTPForbidden, though it makes it more clear why access was disallowed).`

Method resolution order:
  HTTPNotFound
  HTTPException
  exceptions.Exception

Methods defined here:

html(self)

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPNotImplemented(HTTPException)
`` | `HTTPExcecption "not implemented" subclass. When methods (like GET, POST, PUT, PROPFIND, etc) are not implemented for this resource.`

Method resolution order:
  HTTPNotImplemented
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

class HTTPPreconditionFailed(HTTPException)
`` | `HTTPExcecption "Precondition Failed" subclass. During compound, atomic operations, when a precondition for an early operation fail, then later operations in will fail with this code. Mostly for WebDAV.`

Method resolution order:
  HTTPPreconditionFailed
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

HTTPRedirect = class HTTPTemporaryRedirect(HTTPMovedPermanently)
`` | `HTTPExcecption "temporary tedirect" subclass. Like HTTPMovedPermanently, except the redirect is only valid for this request. Internally identical to HTTPMovedPermanently, except with a different response code. Browsers will check the server for each request to see where it's redirected to.`

Method resolution order:
  HTTPTemporaryRedirect
  HTTPMovedPermanently
  HTTPException
  exceptions.Exception

Methods inherited from HTTPMovedPermanently:

__init__(self, location=None, webkitLocation=None, *args)
  `Set destination.
  HTTPMovedPermanently needs a destination that you it should be
  directed to -- you can pass `location` *or* `webkitLocation` --
  if you pass `webkitLocation` it will be relative to the WebKit base
  (the portion through the adapter).`

description(self)

headers(self)
  `We include a Location header.`

location(self)
  `The location that we will be redirecting to.`

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__str__(...)

class HTTPTemporaryRedirect(HTTPMovedPermanently)
`` | `HTTPExcecption "temporary tedirect" subclass. Like HTTPMovedPermanently, except the redirect is only valid for this request. Internally identical to HTTPMovedPermanently, except with a different response code. Browsers will check the server for each request to see where it's redirected to.`

Method resolution order:
  HTTPTemporaryRedirect
  HTTPMovedPermanently
  HTTPException
  exceptions.Exception

Methods inherited from HTTPMovedPermanently:

__init__(self, location=None, webkitLocation=None, *args)
  `Set destination.
  HTTPMovedPermanently needs a destination that you it should be
  directed to -- you can pass `location` *or* `webkitLocation` --
  if you pass `webkitLocation` it will be relative to the WebKit base
  (the portion through the adapter).`

description(self)

headers(self)
  `We include a Location header.`

location(self)
  `The location that we will be redirecting to.`

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__str__(...)

class HTTPUnsupportedMediaType(HTTPException)
`` | `HTTPExcecption "unsupported media type" subclass.`

Method resolution order:
  HTTPUnsupportedMediaType
  HTTPException
  exceptions.Exception

Methods inherited from HTTPException:

code(self)
  `The integer code.`

codeMessage(self)
  `The message (like ``Not Found``) that goes with the code.`

description(self)
  `Error description.
  Possibly a plain text version of the error description,
  though usually just identical to `htDescription`.`

headers(self)
  `Get headers.
  Additional headers that should be sent with the
  response, not including the Status header. For instance,
  the redirect exception adds a Location header.`

htBody(self)
  `The HTML body of the page.`

htDescription(self)
  `HTML error description.
  The HTML description of the error, for presentation
  to the browser user.`

htTitle(self)
  `The title, but it may include HTML markup (like italics).`

html(self)
  `The error page.
  The HTML page that should be sent with the error,
  usually a description of the problem.`

setTransaction(self, trans)
  `Set transaction.
  When the exception is caught by `Application`, it tells
  the exception what the transaction is. This way you
  can resolve relative paths, or otherwise act in a manner
  sensitive of the context of the error.`

title(self)
  `The title used in the HTML page.`

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

Data
`` |  | StringTypes = (<type 'str'>, <type 'unicode'>)