Ticket #12027: 12027_regex.diff

File 12027_regex.diff, 1.2 KB (added by Tim Graham, 11 years ago)
  • django/core/validators.py

    diff --git a/django/core/validators.py b/django/core/validators.py
    index 796c57e..cf5ec7a 100644
    a b class EmailValidator(object):  
    8989        r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string
    9090        re.IGNORECASE)
    9191    domain_regex = re.compile(
    92         r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})\.?$'  # domain
     92        r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})$'  # domain
    9393        # literal form, ipv4 address (SMTP 4.1.3)
    9494        r'|^\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$',
    9595        re.IGNORECASE)
  • tests/validators/tests.py

    diff --git a/tests/validators/tests.py b/tests/validators/tests.py
    index 367bd43..e3f418e 100644
    a b TEST_DATA = (  
    5656    # Quoted-string format (CR not allowed)
    5757    (validate_email, '"\\\011"@here.com', None),
    5858    (validate_email, '"\\\012"@here.com', ValidationError),
     59    (validate_email, 'trailingdot@shouldfail.com.', ValidationError),
    5960
    6061    (validate_slug, 'slug-ok', None),
    6162    (validate_slug, 'longer-slug-still-ok', None),
Back to Top