Ticket #12196: 12196.2.diff

File 12196.2.diff, 1.5 KB (added by Chris Beaven, 14 years ago)
  • django/core/validators.py

    diff --git a/django/core/validators.py b/django/core/validators.py
    index b1b82db..16be826 100644
    a b class EmailValidator(RegexValidator):  
    114114                raise
    115115
    116116email_re = re.compile(
    117     r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
     117    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.+[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
    118118    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
    119119    r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE)  # domain
    120120validate_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 44ad176..870a5d6 100644
    a b TEST_DATA = (  
    2020
    2121    (validate_email, 'email@here.com', None),
    2222    (validate_email, 'weirder-email@here.and.there.com', None),
     23    (validate_email, 'example...99@valid.com', None),
    2324
    2425    (validate_email, None, ValidationError),
    2526    (validate_email, '', ValidationError),
    2627    (validate_email, 'abc', ValidationError),
    2728    (validate_email, 'a @x.cz', ValidationError),
    2829    (validate_email, 'something@@somewhere.com', ValidationError),
     30    (validate_email, 'example.@invalid.com', ValidationError),
    2931
    3032    (validate_slug, 'slug-ok', None),
    3133    (validate_slug, 'longer-slug-still-ok', None),
Back to Top