Projet

Général

Profil

0006-emails-validators-catch-all-dns-exceptions-32435.patch

Christophe Siraut, 18 avril 2019 12:41

Télécharger (1009 octets)

Voir les différences:

Subject: [PATCH 6/6] emails/validators: catch all dns exceptions (#32435)

 hobo/emails/validators.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hobo/emails/validators.py
28 28
    email_domain = value.split('@')[-1]
29 29
    try:
30 30
        mx_server = sorted(dns.resolver.query(email_domain, 'MX'), key=lambda rdata: rdata.preference)[0].exchange.to_text()
31
    except dns.resolver.NXDOMAIN as e:
32
        raise ValidationError(_('Error: %s') % str(e))
33
    except dns.resolver.NoAnswer as e:
31
    except dns.exception.DNSException as e:
34 32
        raise ValidationError(_('Error: %s') % str(e))
35 33
    smtp = smtplib.SMTP(timeout=10)
36 34
    try:
37
-