Ticket #12005: email.patch
File email.patch, 1.9 KB (added by , 15 years ago) |
---|
-
django/forms/fields.py
418 418 raise ValidationError(self.error_messages['invalid']) 419 419 return value 420 420 421 email_re = re.compile( 422 r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom 423 r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string 424 r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain 421 email_re = re.compile(r"""^ # start-of-line 422 ( 423 [-!#$%&'*+/=?^_`{}|~0-9A-Z]+ 424 (\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)* # dot-atom 425 | 426 "([\001-\010\013\014\016-\037!#-\[\]-\177] 427 |\\[\001-011\013\014\016-\177])*" # quoted-string 428 ) # user 429 @ 430 ((?:[A-Z0-9]|[A-Z0-9]-+(?=[A-Z0-9]))+\.)* # subdomains 431 (?:[A-Z0-9](?:[A-Z0-9]|-+(?=[A-Z0-9]))+\.)+ # domain 432 [A-Z]{2,6} # TLD 433 $ # end of line 434 """, re.IGNORECASE | re.VERBOSE) # domain 425 435 426 436 class EmailField(RegexField): 427 437 default_error_messages = { -
tests/regressiontests/forms/fields.py
767 767 >>> f.clean('example@valid-with-hyphens.com') 768 768 u'example@valid-with-hyphens.com' 769 769 770 >>> f.clean('example@a.single.letter.subdomain.com') 771 u'example@a.single.letter.subdomain.com' 772 770 773 # Check for runaway regex security problem. This will take for-freeking-ever 771 774 # if the security fix isn't in place. 772 775 >>> f.clean('viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058')