*What steps will reproduce the problem?
import formalchemy
class Bob(object):
username = formalchemy.Field(type=formalchemy.fatypes.Text)
fs = formalchemy.FieldSet(Bob)
fs = fs.bind(Bob, data={'notusername':'asdf'})
fs.validate()
*What is the expected output? What do you see instead?
Validation to return False, with the errors dict showing which items are
missing.
*Please use labels and text to provide additional information.
I modified 1.3.2 to, instead of throwing a KeyError, validate but give a
ValidationError on the items that didn't have a coresponding data key. Form
items can also be given an .optional() argument to say that it is ok to not
include the form item in the data, and what the default value will be. If
.optional() is not given then no value given (except for checkbox/radio values)
will not validate.
If you find this functionality useful I can update the docs to reflect these
changes as well.
If the patch is in the wrong format, please let me know.
Original issue reported on code.google.com by warrench...@gmail.com on 21 Oct 2010 at 8:59
Original issue reported on code.google.com by
warrench...@gmail.com
on 21 Oct 2010 at 8:59Attachments: