Ticket #12196: 12196-2.diff
File 12196-2.diff, 1.3 KB (added by , 15 years ago) |
---|
-
django/forms/fields.py
419 419 return value 420 420 421 421 email_re = re.compile( 422 r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\. [-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom422 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 424 r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain 425 425 -
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...99@valid.com') 771 u'example...99@valid.com' 772 773 >>> f.clean('example.@invalid.com') 774 Traceback (most recent call last): 775 ... 776 ValidationError: [u'Enter a valid e-mail address.'] 777 770 778 # Check for runaway regex security problem. This will take for-freeking-ever 771 779 # if the security fix isn't in place. 772 780 >>> f.clean('viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058')