Partial Validation, Partially Validated data
"Ian Wilson" <[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
For most forms I make one giant schema that validates the entire form
at submission. If I use ajax style validation per field is there a
way I can use the large schema to do partial validation of just that
field easily ? I tried setting ignore_key_missing=True but I have to
set it on each sub schema which seems kind of impractical but maybe I
could make two different schemas from one by messing around with the
internals...? Any insight would be much appreciated.
For example:
class UserSchema(Schema):
name = String(not_empty=True)
age = Int(not_empty=True)
pre_validators=[NestedVariables]
class FormSchema(Schema):
user = UserSchema()
# Only validate age but ignore name?
FormSchema.to_python({'user.age': 25})
Thanks
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/