Go to the latest version of this document.

# ``twisted`.`web`.`pages``

module documentation
(source)

Utility implementations of `IResource`.

Function | `errorPage` | Build a resource that responds to all requests with a particular HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.
Function | `forbidden` | Generate an `IResource` with a 403 Forbidden status code.
Function | `notFound` | Generate an `IResource` with a 404 Not Found status code.
Class | `_ErrorPage` | `_ErrorPage` is a resource that responds to all requests with a particular (parameterized) HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.

def errorPage(code: `int`, brief: `str`, detail: `str`) -> `_ErrorPage`: (source)

Build a resource that responds to all requests with a particular HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.

The resource dynamically handles all paths below it. Use `IResource.putChild()` to override a specific path.

Parameters
code:`int` | An integer HTTP status code which will be used for the response.
brief:`str` | A short string which will be included in the response body as the page title.
detail:`str` | A longer string which will be included in the response body.

Returns
`_ErrorPage` | An `IResource`

def forbidden(brief: `str` = 'Forbidden Resource', message: `str` = 'Sorry, resource is forbidden.') -> `IResource`: (source)

Generate an `IResource` with a 403 Forbidden status code.

Parameters
brief:`str` | A short string displayed as the page title.
message:`str` | A longer string displayed in the page body.

Returns
`IResource` | An `IResource`

See Also
`twisted.web.pages.errorPage`

def notFound(brief: `str` = 'No Such Resource', message: `str` = 'Sorry. No luck finding that resource.') -> `IResource`: (source)

Generate an `IResource` with a 404 Not Found status code.

Parameters
brief:`str` | A short string displayed as the page title.
message:`str` | A longer string displayed in the page body.

Returns
`IResource` | An `IResource`

See Also
`twisted.web.pages.errorPage`