Projet

Général

Profil

0001-emails-avoid-unnecessary-multiple-variables-with-uge.patch

Christophe Siraut, 17 avril 2019 17:17

Télécharger (1,65 ko)

Voir les différences:

Subject: [PATCH] emails: avoid unnecessary multiple variables with
 ugettext_lazy (#32426)

 hobo/emails/validators.py | 4 ++--
 tests/test_emails.py      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
hobo/emails/validators.py
34 34
    try:
35 35
        smtp.connect(mx_server)
36 36
    except socket.error as e:
37
        raise ValidationError(_('Error while connecting to %s: %s') % (mx_server, str(e)))
37
        raise ValidationError(_('Error while connecting: %s') % str(e))
38 38
    status, msg = smtp.helo()
39 39
    if status != 250:
40 40
        smtp.quit()
41
        raise ValidationError(_('Error while connecting to %s: %s') % (mx_server, msg))
41
        raise ValidationError(_('Error while connecting: %s') % msg)
42 42
    smtp.mail('')
43 43
    status, msg = smtp.rcpt(value)
44 44
    if status == 250:
tests/test_emails.py
83 83
    monkeypatch.setattr('smtplib.SMTP.connect', socket_error)
84 84
    with pytest.raises(ValidationError) as e:
85 85
        validate_email_address('john.doe@example.com')
86
    assert 'Error' in str(e.value)
86
    assert 'Error while connecting' in str(e.value)
87 87

  
88 88

  
89 89
def test_invalid_address(client, admin_user):
90
-