The htmlfill module is accessible via the formencode module.
Formatter that escapes the error, wraps the error in a span with class error-message, and adds a <br>
Render the form (which should be a string) given the defaults and errors. Defaults are the values that go in the input fields (overwriting any values that are there) and errors are displayed inline in the form (and also effect input classes). Returns the rendered string.
If auto_insert_errors is true (the default) then any errors for which <form:error> tags can't be found will be put just above the associated input field, or at the top of the form if no field can be found.
If use_all_keys is true, if there are any extra fields from defaults or errors that couldn't be used in the form it will be an error.
error_formatters is a dictionary of formatter names to one-argument functions that format an error into HTML. Some default formatters are provided if you don't provide this.
error_class is the class added to input fields when there is an error for that field.
add_attributes is a dictionary of field names to a dictionary of attribute name/values. If the name starts with + then the value will be appended to any existing attribute (e.g., {'+class': ' important'}).
auto_error_formatter is used to create the HTML that goes above the fields. By default it wraps the error message in a span and adds a <br>.
If text_as_default is true (default false) then <input type=unknown> will be treated as text inputs.
listener can be an object that watches fields pass; the only one currently is in htmlfill_schemabuilder.SchemaBuilder
encoding specifies an encoding to assume when mixing str and unicode text in the template.
Fills HTML with default values, as in a form.
Examples:
>>> defaults = {'name': 'Bob Jones',
... 'occupation': 'Crazy Cultist',
... 'address': '14 W. Canal\nNew Guinea',
... 'living': 'no',
... 'nice_guy': 0}
>>> parser = FillingParser(defaults)
>>> parser.feed('<input type="text" name="name" value="fill">\
... <select name="occupation"><option value="">Default</option>\
... <option value="Crazy Cultist">Crazy cultist</option>\
... </select> <textarea cols=20 style="width: 100%" name="address">An address\
... </textarea> <input type="radio" name="living" value="yes">\
... <input type="radio" name="living" value="no">\
... <input type="checkbox" name="nice_guy" checked="checked">')
>>> print parser.text()
<input type="text" name="name" value="Bob Jones">
<select name="occupation">
<option value="">Default</option>
<option value="Crazy Cultist" selected="selected">Crazy cultist</option>
</select>
<textarea cols=20 style="width: 100%" name="address">14 W. Canal
New Guinea</textarea>
<input type="radio" name="living" value="yes">
<input type="radio" name="living" value="no" selected="selected">
<input type="checkbox" name="nice_guy">
This class contains 37 members.
This class contains 2 members.
See the source for more information.