[Django] #23224: Unable to validate "webmaster@lab" via EmailField() validation

19 views
Skip to first unread message

Django

unread,
Aug 5, 2014, 2:59:33 PM8/5/14
to django-...@googlegroups.com
#23224: Unable to validate "webmaster@lab" via EmailField() validation
-----------------------------------+-------------------------------
Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7-alpha-2
Severity: Normal | Keywords: SMTP email syntax
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+-------------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/23224>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 5, 2014, 4:10:11 PM8/5/14
to django-...@googlegroups.com
#23224: Unable to validate "webmaster@lab" via EmailField() validation
-----------------------------------+---------------------------------------

Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7-alpha-2
Severity: Normal | Resolution:

Keywords: SMTP email syntax | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by CollinAnderson):

* 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>

Django

unread,
Aug 6, 2014, 7:39:40 AM8/6/14
to django-...@googlegroups.com
#23224: Unable to validate "webmaster@lab" via EmailField() validation
-----------------------------------+---------------------------------------

Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7-alpha-2
Severity: Normal | Resolution:

Keywords: SMTP email syntax | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by areski):

* 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>

Django

unread,
Aug 13, 2014, 7:19:00 AM8/13/14
to django-...@googlegroups.com
#23224: Document EmailValidator domain whitelist parameter
-----------------------------------+---------------------------------------

Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.7-alpha-2
Severity: Normal | Resolution:
Keywords: SMTP email syntax | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Aug 13, 2014, 10:21:09 AM8/13/14
to django-...@googlegroups.com
#23224: Document EmailValidator domain whitelist parameter
-----------------------------------+---------------------------------------
Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.7-alpha-2
Severity: Normal | Resolution:
Keywords: SMTP email syntax | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------

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>

Django

unread,
Aug 14, 2014, 10:47:26 AM8/14/14
to django-...@googlegroups.com
#23224: Document EmailValidator domain whitelist parameter
-----------------------------------+---------------------------------------
Reporter: egberts | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.7-alpha-2
Severity: Normal | Resolution:
Keywords: SMTP email syntax | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23224#comment:5>

Django

unread,
Aug 14, 2014, 1:28:46 PM8/14/14
to django-...@googlegroups.com
#23224: Document EmailValidator domain whitelist parameter
-----------------------------------+---------------------------------------
Reporter: egberts | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.7-alpha-2
Severity: Normal | Resolution: fixed

Keywords: SMTP email syntax | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages