Ticket #12196: 12196-2.diff

File 12196-2.diff, 1.3 KB (added by JohnDoe, 15 years ago)
  • django/forms/fields.py

     
    419419        return value
    420420
    421421email_re = re.compile(
    422     r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
     422    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.+[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
    423423    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
    424424    r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE)  # domain
    425425
  • tests/regressiontests/forms/fields.py

     
    767767>>> f.clean('example@valid-with-hyphens.com')
    768768u'example@valid-with-hyphens.com'
    769769
     770>>> f.clean('example...99@valid.com')
     771u'example...99@valid.com'
     772
     773>>> f.clean('example.@invalid.com')
     774Traceback (most recent call last):
     775...
     776ValidationError: [u'Enter a valid e-mail address.']
     777
    770778# Check for runaway regex security problem. This will take for-freeking-ever
    771779# if the security fix isn't in place.
    772780>>> f.clean('viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058')
Back to Top