Discussion:
[FE-discuss] validate_partial getting raw values
Yoann Roman
2009-12-16 14:34:22 UTC
Permalink
I'm creating a custom FormValidator with support for partial validation,
which I'm using as a chained validator. My problem is that the schema
feeds it the raw value_dict instead of the partially processed form
fields. I narrowed this down to line 185 of schema.py:

for validator in self.chained_validators:
if (not hasattr(validator, 'validate_partial')
or not getattr(validator, 'validate_partial_form', False)):
continue
try:
validator.validate_partial(value_dict, state)
^^^^^^^^^^
except Invalid, e:
sub_errors = e.unpack_errors()
if not isinstance(sub_errors, dict):
# Can't do anything here
continue
merge_dicts(errors, sub_errors)

Shouldn't that be validator.validate_partial(new, state) instead or is
it intentional that partial validation gets the raw value_dict while
full validation gets processed fields?

Thanks,
--
Yoann Roman
Loading...