Package genshi :: Package filters :: Module html :: Class HTMLFormFiller |

# Class HTMLFormFiller

    object --+
             |
            HTMLFormFiller

A stream filter that can populate HTML forms from a dictionary of values.

    >>> from genshi.input import HTML
    >>> html = HTML('''<form>
    ...   <p><input type="text" name="foo" /></p>
    ... </form>''')
    >>> filler = HTMLFormFiller(data={'foo': 'bar'})
    >>> print(html | filler)
    <form>
      <p><input type="text" name="foo" value="bar"/></p>
    </form>

Instance Methods
__init__(self, name=None, id=None, data=None, passwords=False) Create the filter. |
__call__(self, stream) Apply the filter to the given stream. |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, name=None, id=None, data=None, passwords=False) (Constructor) |
Create the filter. Parameters: `name` - The name of the form that should be populated. If this parameter is given, only forms where the `name` attribute value matches the parameter are processed. `id` - The ID of the form that should be populated. If this parameter is given, only forms where the `id` attribute value matches the parameter are processed. `data` - The dictionary of form values, where the keys are the names of the form fields, and the values are the values to fill in. `passwords` - Whether password input fields should be populated. This is off by default for security reasons (for example, a password may end up in the browser cache) Overrides: object.__init__ Note: Changed in 0.5.2: added the `passwords` option

### __call__(self, stream) (Call operator) |
Apply the filter to the given stream. Parameters: `stream` - the markup event stream to filter