Opened 10 years ago
Closed 10 years ago
#23224 closed Bug (fixed)
Document EmailValidator domain whitelist parameter
Reported by: | egberts | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.7-alpha-2 |
Severity: | Normal | Keywords: | SMTP email syntax |
Cc: | areski@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am unable to validate "webmaster@lab" email address using EmailField()
validator.
Examination of Test framework (TEST_DATA
in tests.py
) shows that it won't take the "abc@bar" email format.
TEST_DATA = ... (validate_email, 'abc@bar', ValidationError) ...
Did I miss something new amongst the vast IETF specifications regarding this new restrictive email syntax? Or must we expand our 20yo Lab domain name to something like 'lab.test'?
Tarball File Used: django-django-1.7a3-1364-gedcc75e.zip
Change History (6)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Cc: | added |
---|
FYI this is where django implement the email validation: https://github.com/django/django/blob/master/django/core/validators.py#L119
documentation on validators: https://docs.djangoproject.com/en/dev/ref/forms/validation/#using-validation-in-practice
From this, you will notice that there is an easy way to validate abc@bar
:
from django.forms import EmailField from django.core.validators import EmailValidator class MyEmailField(EmailField): default_validators = [EmailValidator(whitelist=['bar'])] MyEmailField().clean('abc@bar')
comment:3 by , 10 years ago
Component: | Testing framework → Documentation |
---|---|
Summary: | Unable to validate "webmaster@lab" via EmailField() validation → Document EmailValidator domain whitelist parameter |
Triage Stage: | Unreviewed → Accepted |
We should document the solution described by areski.
comment:4 by , 10 years ago
Here a PR for to document the solution https://github.com/django/django/pull/3055
comment:5 by , 10 years ago
Has patch: | set |
---|
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
as a data point: yes, django 1.6 gives the same error message