#36809: Allow EmailValidator to return 'domain_part' in ValidationError params
---------------------------------+-----------------------------------------
Reporter: Daniel E Onetti | Type: Uncategorized
Status: new | Component: Core (Other)
Version: dev | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------------------------
Currently, the EmailValidator only provides the full 'value' in the params
dictionary when a ValidationError is raised. However, in many use cases,
developers need to customize error messages based specifically on the
domain part of the email (e.g., "The domain %(domain_part)s is not
allowed").
This change adds 'domain_part' to the params dictionary in
EmailValidator.__call__, bringing it in line with how other validators
provide decomposed parts of the validated value. This allows for more
granular and helpful error messages for end users.
I have already prepared a patch with tests and verified that it passes all
style (flake8) and functional checks.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36809>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.