Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`web`.`util``

module documentation
(source)

An assortment of web server-related utilities.

Class | `ChildRedirector` | Undocumented
Class | `DeferredResource` | I wrap up a Deferred that will eventually result in a Resource object.
Class | `FailureElement` | `FailureElement` is an `IRenderable` which can render detailed information about a `Failure`.
Class | `ParentRedirect` | Redirect to the nearest directory and strip any query string.
Class | `Redirect` | Resource that redirects to a specific URL.
Function | `formatFailure` | Construct an HTML representation of the given failure.
Function | `redirectTo` | Generate a redirect to the given location.
Class | `_FrameElement` | `_FrameElement` is an `IRenderable` which can render details about one frame from a `Failure`.
Class | `_SourceFragmentElement` | `_SourceFragmentElement` is an `IRenderable` which can render several lines of source code near the line number of a particular frame object.
Class | `_SourceLineElement` | `_SourceLineElement` is an `IRenderable` which can render a single line of source code.
Class | `_StackElement` | `_StackElement` renders an `IRenderable` which can render a list of frames.
Function | `_PRE` | Wraps <pre> tags around some text and HTML-escape it.

def formatFailure(myFailure): (source)

Construct an HTML representation of the given failure.

Consider using `FailureElement` instead.

Parameters
myFailure:`Failure` | Undocumented
Returns
`bytes` | A string containing the HTML representation of the given failure.

def redirectTo(URL, request): (source)

Generate a redirect to the given location.

Parameters
URL:`bytes` | A `bytes` giving the location to which to redirect.
request:`IRequest` provider | The request object to use to generate the redirect.
Returns

`bytes`

A `bytes` containing HTML which tries to convince the client agent to visit the new location even if it doesn't respect the FOUND response code. This is intended to be returned from a render method, eg:

        def render_GET(self, request):
            return redirectTo(b"http://example.com/", request)

Raises
`TypeError` | If the type of `URL` a `str` instead of `bytes`.

def _PRE(text): (source)

Wraps <pre> tags around some text and HTML-escape it.

This is here since once twisted.web.html was deprecated it was hard to migrate the html.PRE from current code to twisted.web.template.

For new code consider using twisted.web.template.

Returns
`str` | Escaped text wrapped in <pre> tags.