Fixes #2799713:
force_defaults=False and <select> fields, regarding formencode.htmlfill.render().
Thanks to w31rd0 for the bug report and patch to fix it.
Added keyword argument force_defaults to
formencode.htmlfill.render(); when this is True (the default)
this will uncheck checkboxes, unselect select boxes, etc., when a
value is missing from the default dictionary.
In formencode.htmlfill use a default encoding of utf8 when
handling mixed str/unicode content. Also do not modify
<inputtype="image"> tags (previously src would be
overwritten, for no good reason).
Make formencode.validators.FieldsMatch give a normal
Invalid exception if you pass it a non-dictionary. Also treat
all missing keys as the empty string (previously the first key was
required and would raise KeyError).
Added a parameter to htmlfill.render(): prefix_error. If
this parameter is true (the default) then errors automatically go
before the input field; if false then they go after the input field.
Remove deprecated modules: fields, formgen, htmlform,
sqlformgen, and sqlschema.
Added formencode.htmlrename, which renames HTML inputs.
In formencode.htmlfill, non-string values are compared usefully
(e.g., a select box with integer values).
The validators Int and Number both take min/max arguments
(from Shannon Behrens).
Validators based on formencode.validators.FormValidator will not
treat {} as an empty (unvalidated) value.
Some adjustments to the URL validator.
formencode.compound.All does not handle empty values,
instead relying on sub-validators to check for emptiness.
Fixed the if_missing attribute in
formencode.foreach.ForEach; previously it would be the same
list instance, so if you modified it then it would effect future
if_missing values (reported by Felix Schwarz).
Added formatter to formencode.htmlfill, so you can use
<form:errorname="field_name"formatter="ignore"/> – this will
cause the error to be swallowed, not shown to the user.
Added formencode.validators.XRI for validation i-names,
i-numbers, URLs, etc (as used in OpenID).
Look in /usr/share/locale for locale files, in addition to the
normal locations.
Added formencode.schema.SimpleFormValidator, which wraps a
simple function to make it a validator.
Changed the use of chained_validators in Schemas, so that all
chained validators get run even when there are previous errors (to
detect all the errors).
While something like Int.to_python() worked, other methods like
Int.message(...) didn’t work. Now it does.
Added Italian, Finnish, and Norwegian translations.
The notion of “empty” has changed to include empty lists,
dictionaries, and tuples. If you get one of these values passed
into (or generated by) a validator with not_empty=True you can
get exceptions where you didn’t previously.
Added support for Paste’s MultiDict dictionary as input to
Schema.to_python, by converting it to a normal dict via MultiDict.mixed.
Previously MultiDicts wouldn’t work with CompoundValidators (like
ForEach)
Added encoding parameter to htmlfill, which will handle cases when mixed
str and unicode objects are used (turning all str objects into unicode)
Include formencode.validators.InternationalPhoneNumber from
W-Mark Kubacki.
validators.Int takes min and max options (from Felix
Schwarz).
You can control the missing message (which by default is just
“Missing Value”) using the message "missing" in a validator
(also from James Gardner).
Added validators.CADR (for IP addresses with an optional range)
and validators.MACAddress (from Christoph Haas).
Be friendlier when loaded from a zip file (as with py2exe);
previously only egg zip files would work.
Fixed bug in htmlfill when a document ends with no trailing text
after the last tag.
Fix problem with HTMLParser’s default unescaping routing, which only
understood a very limited number of entities in attribute values.
Fix problem with looking up A records for email addresses.
validators.String now always returns strings. It also converts
lists to comma-separated strings (no [...]), and can encode
unicode if an encoding parameter is given. Empty values are
handled better.
Backward compatibility issue: Due to the addition of i18n
(internationalization) to FormEncode, Invalid exceptions now have
unicode messages. You may encounter unicode-related errors if you
are mixing these messages with non-ASCII str strings.
String(min=1) implies not_empty (which seems more intuitive)
Added list_char and dict_char arguments to
Invalid.unpack_errors (passed through to variable_encode)
Added a use_datetime option to TimeValidator, which will
cause it to use datetime.time objects instead of tuples. It was
previously able to consume but not produce these objects.
Added <form:iferrorname="notfield_name"> when you want to
include text only when a field has no errors.
There was a problem installing 0.5.1 on Windows with Python 2.5, now
resolved.
Validator __doc__ attributes will include some
automatically-appended information about all the message strings
that validator uses.
Deprecated formencode.htmlform module, because it is dumb.
Added an .all_messages() method to all validators, primarily
intended to be used for documentation purposes.
Changed preferred name of StringBoolean to StringBool (to go
with bool and validators.Bool). Old alias still available.
Added today_or_after option to validators.DateValidator.
Added a validators.FileUploadKeeper validator for helping with
file uploads in failed forms. It still requires some annoying
fiddling to make work, though, since file upload fields are so
weird.
Added text_as_default option to htmlfill. This treats all
<inputtype="something-weird"> elements as text fields. WHAT-WG
adds weird input types, which can usually be usefully treated as
text fields.
Make all validators accept empty values if not_empty is False
(the default). “Empty” means "" or None, and will generally
be converted None.
Added accept_python boolean to all FancyValidator validators
(which is most validators). This is a fixed version of the broken
validate_python boolean added in 0.3. Also, it defaults to
true, which means that all validators will not validate during
.from_python() calls by default.
Added htmlfill.render(form,defaults,errors) for easier
rendering of forms.
Errors automatically inserted by htmlfill will go at the top of
the form if there’s no field associated with the error (raised an
error in 0.3).
Added formencode.sqlschema for wrapping SQLObject
classes/instances. See the docstring for more.
Added ignore_key_missing to Schema objects, which ignore
missing keys (where fields are present) when no if_missing is
provided for the field.
Renamed validators.StateProvince.extraStates to
extra_states, to normalize style.
Allow errors to be inserted automatically into a form when using
formencode.htmlfill, when a <form:error> tag isn’t found for
an error.
Added if_key_missing attribute to schema.Schema, which will
fill in any keys that are missing and pass them to the validator.
FancyValidator has changed, adding if_invalid_python and
validate_python options (which also apply to all subclasses).
Also if_empty only applies to to_python conversions.
FancyValidator now has a strip option, which if true and if
input is a string, will strip whitespace from the string.
Allow chained validators to validate otherwise-invalid forms, if
they define a validate_partial method. The credit card
validator does this.
Handle FieldStorage input (from file uploads); added a
formencode.fieldstorage module to wrap those instances in
something a bit nicer. Added
validators.FieldStorageUploadConverter to make this conversion.
Added StringBoolean converter, which converts strings like
"true" to Python booleans.