pallets-eco / pallets-eco/wtforms
Email() validation failed should raise a StopValidation error
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
Look at this case:
class UserForm(FlaskForm):
email = StringField('email', validators=[Email()])
def validate_email(self, field):
if not User.query.filter_by(email=email).first():
raise ...
If input is not a email, validate_email will still be executed, which make no sense. So I think Email should raise a StopValidation error.
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 the Email() validator and StopValidation behavior, then follow how the validate_email method is invoked after field validation fails. Check the existing validation tests and add coverage for invalid email input to confirm whether the custom validator should be skipped.
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
- 38/100