Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/flex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Subpackages

.. toctree::

flex.compat
flex.loading
flex.validation

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Flex implements format validation for the following formats
* ``int64``:
Integers up to 64 bits.
* ``email``:
via https://pypi.python.org/pypi/validate_email
via https://pypi.python.org/pypi/email-validator
* ``uri``:
via https://pypi.python.org/pypi/rfc3987

Expand Down
Empty file removed flex/compat/__init__.py
Empty file.
212 changes: 0 additions & 212 deletions flex/compat/validate_email.py

This file was deleted.

13 changes: 4 additions & 9 deletions flex/formats.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import datetime
import re

import six

from email_validator import validate_email, EmailNotValidError
import rfc3987
import strict_rfc3339

Expand All @@ -22,12 +21,6 @@
)
from flex.error_messages import MESSAGES

if six.PY2:
import validate_email
else:
# TODO: when a new version is released, this can be removed.
from flex.compat import validate_email


class FormatRegistry(object):
def __init__(self):
Expand Down Expand Up @@ -99,7 +92,9 @@ def int64_validator(value, **kwargs):

@register(EMAIL, STRING)
def email_validator(value, **kwargs):
if not validate_email.validate_email(value):
try:
validate_email(value)
except EmailNotValidError:
raise ValidationError(MESSAGES['format']['invalid_email'].format(value))


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
six>=1.7.3
PyYAML>=3.11
validate-email>=1.2
email-validator>=1.0
rfc3987>=1.3.4
requests>=2.4.3
strict-rfc3339>=0.7
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
install_requires=[
"six>=1.7.3",
"PyYAML>=3.11",
"validate-email>=1.2",
"email-validator>=1.0",
"rfc3987>=1.3.4",
"requests>=2.4.3",
"strict-rfc3339>=0.7",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ envlist=

[flake8]
max-line-length= 100
exclude= tests/*,flex/compat/validate_email.py
exclude= tests/*

[testenv]
commands=py.test --tb native {posargs:tests}
Expand Down