Ticket #17100: 17100.diff

File 17100.diff, 1.5 KB (added by Claude Paroz, 13 years ago)

Fix missing backslash and tests

  • django/core/validators.py

    diff --git a/django/core/validators.py b/django/core/validators.py
    index 69e60eb..e5ec3e2 100644
    a b class EmailValidator(RegexValidator):  
    158158
    159159email_re = re.compile(
    160160    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
    161     r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
     161    # quoted-string, see also http://tools.ietf.org/html/rfc2822#section-3.2.5
     162    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"'
    162163    r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)'  # domain
    163164    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)
    164165validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid')
  • tests/modeltests/validators/tests.py

    diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py
    index 9e254b9..a1a48bf 100644
    a b TEST_DATA = (  
    3030    (validate_email, 'a @x.cz', ValidationError),
    3131    (validate_email, 'something@@somewhere.com', ValidationError),
    3232    (validate_email, 'email@127.0.0.1', ValidationError),
     33    # Quoted-string format (CR not allowed)
     34    (validate_email, '"\\\011"@here.com', None),
     35    (validate_email, '"\\\012"@here.com', ValidationError),
    3336
    3437    (validate_slug, 'slug-ok', None),
    3538    (validate_slug, 'longer-slug-still-ok', None),
Back to Top