diff --git a/django/core/validators.py b/django/core/validators.py
index 69e60eb..e5ec3e2 100644
a
|
b
|
class EmailValidator(RegexValidator):
|
158 | 158 | |
159 | 159 | email_re = re.compile( |
160 | 160 | r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom |
161 | | r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string |
| 161 | # quoted-string, see also http://tools.ietf.org/html/rfc2822#section-3.2.5 |
| 162 | r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' |
162 | 163 | r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)' # domain |
163 | 164 | r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', re.IGNORECASE) # literal form, ipv4 address (SMTP 4.1.3) |
164 | 165 | validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid') |
diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py
index 9e254b9..a1a48bf 100644
a
|
b
|
TEST_DATA = (
|
30 | 30 | (validate_email, 'a @x.cz', ValidationError), |
31 | 31 | (validate_email, 'something@@somewhere.com', ValidationError), |
32 | 32 | (validate_email, 'email@127.0.0.1', ValidationError), |
| 33 | # Quoted-string format (CR not allowed) |
| 34 | (validate_email, '"\\\011"@here.com', None), |
| 35 | (validate_email, '"\\\012"@here.com', ValidationError), |
33 | 36 | |
34 | 37 | (validate_slug, 'slug-ok', None), |
35 | 38 | (validate_slug, 'longer-slug-still-ok', None), |