class documentation

class RenderableForm: (source)

Implements interfaces: twisted.web.iweb.IRenderable

View In Hierarchy

An IRenderable representing a renderable form.

Method glue Provide any glue necessary to render this form; this must be dropped into the template within the <form> tag.
Method lookupRenderMethod Form renderers don't supply any render methods, so this just always raises MissingRenderMethod.
Method render Render this form to the given request.
Constant ENCTYPE_FORM_DATA Undocumented
Constant ENCTYPE_URL_ENCODED Undocumented
Instance Variable prevalidationValues a dict mapping {Field: list of str}, representing the value that each field received as part of the request.
Instance Variable validationErrors a dict mapping {Field: ValidationError}
Method _fieldForCSRF No summary
Method _fieldsToRender No summary
Instance Variable _action Undocumented
Instance Variable _encoding Undocumented
Instance Variable _enctype Undocumented
Instance Variable _form Undocumented
Instance Variable _method Undocumented
Instance Variable _session Undocumented
def glue(self): (source)

Provide any glue necessary to render this form; this must be dropped into the template within the <form> tag.

Presently, this glue includes only the CSRF token argument, but Klein reserves the right to add arbitrary HTML here. This should not create any user-visible content, however.

Returns
List[Tag]some HTML elements in the form of renderable objects for twisted.web.template
def lookupRenderMethod(self, name): (source)

Form renderers don't supply any render methods, so this just always raises MissingRenderMethod.

Parameters
name:strUndocumented
Returns
NoReturnUndocumented
def render(self, request): (source)

Render this form to the given request.

Parameters
request:IRequestUndocumented
Returns
TagUndocumented
ENCTYPE_FORM_DATA: str = (source)

Undocumented

Value
'multipart/form-data'
ENCTYPE_URL_ENCODED: str = (source)

Undocumented

Value
'application/x-www-form-urlencoded'
prevalidationValues: Dict[Field, Optional[str]] = (source)

a dict mapping {Field: list of str}, representing the value that each field received as part of the request.

validationErrors: Dict[Field, ValidationError] = (source)

a dict mapping {Field: ValidationError}

def _fieldForCSRF(self): (source)
Returns
FieldA hidden Field containing the cross-site request forgery protection token.
def _fieldsToRender(self): (source)
Returns
Iterable[Field]

an iterable of Field objects to include in the HTML representation of this form. This includes:

  • all the user-specified fields in the form
  • the CSRF protection hidden field
  • if no "submit" buttons are included in the form, one additional field for a default submit button so the form can be submitted.
_action: str = (source)

Undocumented

_encoding: str = (source)

Undocumented

_enctype: str = (source)

Undocumented

_form: IForm = (source)

Undocumented

_method: str = (source)

Undocumented

_session: ISession = (source)

Undocumented