class documentation

A Field is a static part of a Form.

Class Method hidden Shorthand for a hidden field.
Class Method number An integer within the range [minimum, maximum].
Class Method password Shorthand for a form field that, like text, contains a short string, but should be obscured when typed (and, to the extent possible, obscured in other sensitive contexts, such as logging.)
Class Method submit A field representing a submit button, with a value (displayed on the button).
Class Method text Shorthand for a form field that contains a short string, and will be rendered as a plain <input>.
Method asTags Convert this Field into some stuff that can be rendered in a twisted.web.template.
Method extractValue Extract a value from the request.
Method maybeNamed Create a new Field like this one, but with all the name default values filled in.
Method registerInjector Register this form field as a dependency injector.
Method validateValue Validate the given text and return a converted Python object to use, or fail with ValidationError.
Instance Variable converter The converter.
Instance Variable default Undocumented
Instance Variable error Undocumented
Instance Variable formFieldName Undocumented
Instance Variable formInputType Undocumented
Instance Variable formLabel Undocumented
Instance Variable noLabel Undocumented
Instance Variable pythonArgumentName Undocumented
Instance Variable required Undocumented
Instance Variable value Undocumented
@classmethod
def hidden(cls, name, value, **kw): (source)

Shorthand for a hidden field.

Parameters
name:strUndocumented
value:strUndocumented
**kw:AnyUndocumented
Returns
FieldUndocumented
@classmethod
def number(cls, minimum=None, maximum=None, kind=float, **kw): (source)

An integer within the range [minimum, maximum].

Parameters
minimum:Optional[int]Undocumented
maximum:Optional[int]Undocumented
kind:TypeUndocumented
**kw:AnyUndocumented
Returns
FieldUndocumented
@classmethod
def password(cls, **kw): (source)

Shorthand for a form field that, like text, contains a short string, but should be obscured when typed (and, to the extent possible, obscured in other sensitive contexts, such as logging.)

Parameters
**kw:AnyUndocumented
Returns
FieldUndocumented
@classmethod
def submit(cls, value): (source)

A field representing a submit button, with a value (displayed on the button).

Parameters
value:strUndocumented
Returns
FieldUndocumented
@classmethod
def text(cls, **kw): (source)

Shorthand for a form field that contains a short string, and will be rendered as a plain <input>.

Parameters
**kw:AnyUndocumented
Returns
FieldUndocumented
def asTags(self): (source)

Convert this Field into some stuff that can be rendered in a twisted.web.template.

Returns
Iterable[Tag]A new set of tags to include in a template.
def extractValue(self, request): (source)

Extract a value from the request.

In the case of key/value form posts, this attempts to reliably make the value into str. In the case of a JSON post, however, it will simply extract the value from the top-level dictionary, which means it could be any arrangement of JSON-serializiable objects.

Parameters
request:IRequestUndocumented
Returns
AnyUndocumented
def maybeNamed(self, name): (source)

Create a new Field like this one, but with all the name default values filled in.

Parameters
name:strthe name.
Returns
FieldUndocumented
def registerInjector(self, injectionComponents, parameterName, requestLifecycle): (source)

Register this form field as a dependency injector.

Parameters
injectionComponents:ComponentizedUndocumented
parameterName:strUndocumented
requestLifecycle:IRequestLifecycleUndocumented
Returns
IDependencyInjectorUndocumented
def validateValue(self, value): (source)

Validate the given text and return a converted Python object to use, or fail with ValidationError.

Parameters
value:AnyThe value that was extracted by Field.extractValue.
Returns
AnyThe converted value.
converter: Callable[[AnyStr], Any] = (source)

The converter.

default: Optional[Any] = (source)

Undocumented

error: Optional[ValidationError] = (source)

Undocumented

formFieldName: Optional[str] = (source)

Undocumented

formInputType: str = (source)

Undocumented

formLabel: Optional[str] = (source)

Undocumented

noLabel: bool = (source)

Undocumented

pythonArgumentName: Optional[str] = (source)

Undocumented

required: bool = (source)

Undocumented

value: str = (source)

Undocumented