#34961: Add a max_length parameter to EmailValidator
------------------------------------------------+------------------------
Reporter: jecarr | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: 4.2
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 |
------------------------------------------------+------------------------
- I was using EmailValidator on a string
- It wasn't on an EmailField (which has a
[https://github.com/django/django/blob/4.2.7/django/db/models/fields/__init__.py#L1849
default max-length of 254])
- But I did want some consistency with EmailFields I have elsewhere in my
application
- The EmailValidator allows a
[https://github.com/django/django/blob/4.2.7/django/core/validators.py#L209
max-length of 320] (as is mentioned
[https://docs.djangoproject.com/en/4.2/ref/validators/#emailvalidator in
the docs] too)
- Apologies if I've misunderstood design-reasons around this, but I
wondered if we could have in EmailValidator a max_length property?
- So if the 320-max-length is intentional, have EmailValidator's init
function take `message=None, code=None, allowlist=None, max_length=320` as
its default parameters. And then use a property `max_length` in the
length-check.
--
Ticket URL: <https://code.djangoproject.com/ticket/34961>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018bb4071c44-67e09dfc-28d0-4de7-aff9-3fdcf819f51c-000000%40eu-central-1.amazonses.com.