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
--
Ticket URL: <https://code.djangoproject.com/ticket/23224>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
as a data point: yes, django 1.6 gives the same error message
{{{
>>> from django import forms
>>> forms.EmailField().clean('webmaster@lab')
ValidationError: [u'Enter a valid email address.']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:1>
* cc: areski@… (added)
Comment:
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')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:2>
* component: Testing framework => Documentation
* stage: Unreviewed => Accepted
Comment:
We should document the solution described by areski.
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:3>
Comment (by areski):
Here a PR for to document the solution
https://github.com/django/django/pull/3055
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"2a4492aecb50122f7cc2c643f7ea5b086f301165"]:
{{{
#!CommitTicketReference repository=""
revision="2a4492aecb50122f7cc2c643f7ea5b086f301165"
Fixed #23224 - Documented EmailValidator.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:6>