EmailValidator and ipv4 or ipv6 address

35 views
Skip to first unread message

Ilya Deynega

unread,
Oct 7, 2016, 7:31:06 AM10/7/16
to django...@googlegroups.com
Hello, I've encountered a strange behavior of django.core.validators.EmailValidator, isn't it supposed to accept ip address instead of domain? Like user...@1.1.1.1 instead instead of user...@example.com. In fact, if you try to validate ip address as an email domain part validation fails: EmailValidator().validate_domain_part('8.8.8.8') is False. is it an error in validator or am I missing something?
Source code: https://docs.djangoproject.com/en/1.9/_modules/django/core/validators/
Best regards, Ilya Deynega.

Tim Graham

unread,
Oct 7, 2016, 11:36:39 AM10/7/16
to Django users
I'd take a look at the tests for the validator to see its expected inputs:
https://github.com/django/django/blob/c60feb6999f83bfd1fdabff01f0dd4a26d72e158/tests/validators/tests.py#L48-L96

By the way, there's a ticket to relax the validation and use whatever HTML5 validation uses:
https://code.djangoproject.com/ticket/26423

Ilya Deynega

unread,
Oct 8, 2016, 7:47:10 AM10/8/16
to django...@googlegroups.com
Thanks for your reply, now it's clear that I've misunderstood the format of an email with ip address instead of domain.

Vineet Kothari

unread,
Oct 10, 2016, 5:27:46 PM10/10/16
to django...@googlegroups.com
Domains are also mapped to ip only by DNS

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b73b4-027d-4397-9c4d-c4811d63f2d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages