This is the base class for all widgets that can submit input. It has the machinery to validate and coerce the received data.

class tw.forms.core.InputWidget(*args, **kw)
adjust_value(value, validator=None)
Adjusts the python value sent to InputWidget.display() with the validator so it can be rendered in the template.
validate(value, state=None, use_request_local=True)

Validate value using validator if widget has one. If validation fails a formencode.Invalid exception will be raised.

If use_request_local is True and validation fails the exception and value will be placed at request local storage so if the widget is redisplayed in the same request error and value don’t have to be passed explicitly to display.

Tries to coerce the value to python using the validator. If validation fails the original value will be returned unmodified.
prepare_dict(value, kw, adapt=True)
Prepares the dict sent to the template with functions to access the children’s errors if any.
post_init(*args, **kw)
Takes care of post-initialization of InputWidgets.
Validation error for current request.
Value being validated in current request.


This is the base class to create repeated InputWidgets.

class tw.forms.core.InputWidgetRepeater(*args, **kw)