Code

Ticket #17867: 17867.2.diff

File 17867.2.diff, 1.7 KB (added by Pierre <pierre.matri@…>, 2 years ago)

Working diff file. Previous one was broken.

Line 
1Index: django/core/validators.py
2===================================================================
3--- django/core/validators.py   (revision 17678)
4+++ django/core/validators.py   (working copy)
5@@ -160,7 +160,7 @@
6     r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
7     # quoted-string, see also http://tools.ietf.org/html/rfc2822#section-3.2.5
8     r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"'
9-    r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)'  # domain
10+    r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)$)'  # domain
11     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)
12 validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid')
13 
14Index: tests/regressiontests/forms/tests/fields.py
15===================================================================
16--- tests/regressiontests/forms/tests/fields.py (revision 17678)
17+++ tests/regressiontests/forms/tests/fields.py (working copy)
18@@ -538,6 +538,7 @@
19         self.assertEqual(u'example@valid-with-hyphens.com', f.clean('example@valid-with-hyphens.com'))
20         self.assertRaisesMessage(ValidationError, "[u'Enter a valid e-mail address.']", f.clean, 'example@.com')
21         self.assertEqual(u'local@domain.with.idn.xyz\xe4\xf6\xfc\xdfabc.part.com', f.clean('local@domain.with.idn.xyzäöüßabc.part.com'))
22+        self.assertEqual(u'mailtest@domain.with.idn.tld.उदाहरण.परीक्षा', f.clean('mailtest@domain.with.idn.tld.उदाहरण.परीक्षा'))
23 
24     def test_email_regexp_for_performance(self):
25         f = EmailField()