diff --git a/mongoengine/fields.py b/mongoengine/fields.py index 06c56f06..fe1e40f6 100644 --- a/mongoengine/fields.py +++ b/mongoengine/fields.py @@ -4,6 +4,7 @@ import itertools import re import time import uuid +import socket import warnings from collections import Mapping from operator import itemgetter @@ -154,21 +155,103 @@ class EmailField(StringField): .. versionadded:: 0.4 """ - - EMAIL_REGEX = re.compile( - # dot-atom - r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" - # quoted-string - r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' - # domain (max length of an ICAAN TLD is 22 characters) - r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?