Ticket #16166: ticket_16166_for_r16342.diff

File ticket_16166_for_r16342.diff, 1.6 KB (added by samufuentes, 13 years ago)
  • django/core/validators.py

     
    134134email_re = re.compile(
    135135    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
    136136    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
    137     r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE)  # domain
     137    r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$)'  # domain
     138    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)
    138139validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid')
    139140
    140141slug_re = re.compile(r'^[-\w]+$')
  • tests/modeltests/validators/tests.py

     
    2222
    2323    (validate_email, 'email@here.com', None),
    2424    (validate_email, 'weirder-email@here.and.there.com', None),
     25    (validate_email, 'email@[127.0.0.1]', None),
    2526
    2627    (validate_email, None, ValidationError),
    2728    (validate_email, '', ValidationError),
    2829    (validate_email, 'abc', ValidationError),
    2930    (validate_email, 'a @x.cz', ValidationError),
    3031    (validate_email, 'something@@somewhere.com', ValidationError),
     32    (validate_email, 'email@127.0.0.1', ValidationError),
    3133
    3234    (validate_slug, 'slug-ok', None),
    3335    (validate_slug, 'longer-slug-still-ok', None),
Back to Top