Ticket #9890: emailfield-r9692.diff
File emailfield-r9692.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/forms/fields.py
421 421 email_re = re.compile( 422 422 r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom 423 423 r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string 424 r')@(?:[A-Z0-9 -]+\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain424 r')@(?:[A-Z0-9]+(?:-[A-Z0-9]+)*\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain 425 425 426 426 class EmailField(RegexField): 427 427 default_error_messages = { -
tests/regressiontests/forms/fields.py
745 745 Traceback (most recent call last): 746 746 ... 747 747 ValidationError: [u'Enter a valid e-mail address.'] 748 >>> f.clean('example@invalid-.com') 749 Traceback (most recent call last): 750 ... 751 ValidationError: [u'Enter a valid e-mail address.'] 752 >>> f.clean('example@inv-.alid-.com') 753 Traceback (most recent call last): 754 ... 755 ValidationError: [u'Enter a valid e-mail address.'] 756 >>> f.clean('example@inv-.-alid.com') 757 Traceback (most recent call last): 758 ... 759 ValidationError: [u'Enter a valid e-mail address.'] 760 >>> f.clean('example@inv-----alid.com') 761 Traceback (most recent call last): 762 ... 763 ValidationError: [u'Enter a valid e-mail address.'] 764 >>> f.clean('example@valid-with-hyphens.com') 765 u'example@valid-with-hyphens.com' 748 766 749 767 >>> f = EmailField(required=False) 750 768 >>> f.clean('')