Projet

Général

Profil

0004-emails-validators-do-not-raise-validation-error-on-t.patch

Christophe Siraut, 18 avril 2019 12:41

Télécharger (1,04 ko)

Voir les différences:

Subject: [PATCH 4/6] emails/validators: do not raise validation error on
 temporary failures (#32435)

 hobo/emails/validators.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
hobo/emails/validators.py
41 41
        raise ValidationError(_('Error while connecting to %(server)s: %(msg)s') % {'server': mx_server, 'msg': msg})
42 42
    smtp.mail('')
43 43
    status, msg = smtp.rcpt(value)
44
    if status == 250:
45
        smtp.quit()
46
        return
47 44
    smtp.quit()
48
    raise ValidationError(_('Email address not found on %s') % mx_server)
45
    if status // 100 == 5:
46
        raise ValidationError(_('Email address not found on %s') % mx_server)
49 47

  
50 48

  
51 49
def validate_email_spf(value, strict=False):
52
-