pallets-eco / pallets-eco/wtforms
StopValidation not caught during process_formdata
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
If ValidationError is raised during process_formdata, it is correctly caught and added to .errors. StopValidation is not caught; therefore there is no way to say "I couldn't process the form data, don't run any validators." Right now I need to have a custom validator check if field.data is None: raise StopValidation('couldn't process data').
This is somewhat demonstrated in your own code for dateutil DateTimeField. The field raises a ValidationError if it couldn't parse the data during processing. A form using this field with validators will need to verify that the data is not None before doing anything else that assumes a datetime. This could be handled better if the field raised StopValidation and wtforms handled it correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how process_formdata handles ValidationError and StopValidation, then compare that behavior with the dateutil DateTimeField referenced in the issue. Done means StopValidation raised during data processing is handled so the field records the failure and later validators do not run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100