equal
deleted
inserted
replaced
497 Throws an `DomainError`, if the domain name is too long or doesn't |
497 Throws an `DomainError`, if the domain name is too long or doesn't |
498 look like a valid domain name (label.label.label). |
498 look like a valid domain name (label.label.label). |
499 |
499 |
500 """ |
500 """ |
501 if not RE_DOMAIN.match(domainname): |
501 if not RE_DOMAIN.match(domainname): |
502 domainname = domainname.encode('idna') |
502 domainname = domainname.encode('idna').decode() |
503 if len(domainname) > 255: |
503 if len(domainname) > 255: |
504 raise DomErr(_('The domain name is too long'), DOMAIN_TOO_LONG) |
504 raise DomErr(_('The domain name is too long'), DOMAIN_TOO_LONG) |
505 if not RE_DOMAIN.match(domainname): |
505 if not RE_DOMAIN.match(domainname): |
506 raise DomErr(_("The domain name '%s' is invalid") % domainname, |
506 raise DomErr(_("The domain name '%s' is invalid") % domainname, |
507 DOMAIN_INVALID) |
507 DOMAIN_INVALID) |