Package turbogears :: Package widgets :: Module forms :: Class InputWidget

Class InputWidget

source code

 object --+    
          |    
base.Widget --+
              |
             InputWidget

Instance Methods
 
__init__(self, name=None, validator=None, **params)
Initialize an input widget.
source code
 
path(self) source code
 
name_path(self) source code
 
is_validated(self) source code
 
adjust_value(self, value, **params)
Adjust the value sent to the template on display.
source code
 
display(self, value=None, **params)
Display the widget in a Genshi or Kid template.
source code
 
fq_name(self) source code
 
error(self) source code
 
update_params(self, d)
Update the template parameters.
source code

Inherited from base.Widget: __call__, __repr__, __setattr__, is_named, render, retrieve_css, retrieve_javascript

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables
  validator = None
hash(x)
  params = ["convert"]
  params_doc = {'convert': 'Should the value be coerced by the v...
  convert = True
hash(x)

Inherited from base.Widget: __metaclass__, css, default, engine_name, javascript, name, template

Properties

Inherited from object: __class__

Method Details

__init__(self, name=None, validator=None, **params)
(Constructor)

source code 
Initialize an input widget.

It accepts the following parameters (besides those listed at params):

name:
    Name of the input element. Will be the name of the variable
    the widget's input will be available at when submitted.

validator:
    Formencode validator that will validate and coerce the input
    this widget generates.

Overrides: object.__init__

path(self)

source code 
Decorators:
  • @property
  • @update_path

name_path(self)

source code 
Decorators:
  • @property

is_validated(self)

source code 
Decorators:
  • @property

adjust_value(self, value, **params)

source code 

Adjust the value sent to the template on display.

Overrides: base.Widget.adjust_value
(inherited documentation)

display(self, value=None, **params)

source code 
Display the widget in a Genshi or Kid template.

Returns a Genshi Markup stream or an ElementTree node instance,
depending on the template in which the widget shall be displayed.
If you need serialized output in a string, call 'render' instead.

Probably you will not need to override or extend if inheriting from
Widget.

@params:

value   : The value to display in the widget.
**params: Extra parameters specific to the widget. All keyword params
          supplied will pass through the update_params method which
          will have a last chance to modify them before reaching the
          template.

Decorators:
  • @update_path
Overrides: base.Widget.display
(inherited documentation)

fq_name(self)

source code 
Decorators:
  • @property
  • @update_path

error(self)

source code 
Decorators:
  • @property
  • @update_path

update_params(self, d)

source code 

Update the template parameters.

This method will have the last chance to update the variables sent to the template for the specific request. All parameters listed at class attribute 'params' will be available at the 'params' dict this method receives.

*Must* call super(MyWidget, self).update_params(params) cooperatively, unless, of course, your know what you're doing. Preferably this should be done before any actual work is done in the method.

Overrides: base.Widget.update_params
(inherited documentation)

Class Variable Details

params_doc

Value:
{'convert': 'Should the value be coerced by the validator at ' 'displa\
y?'}