From 6a07bb85a0e3b93350b1eebcd5a649a7fae74bc7 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 23 Feb 2022 20:21:13 +0100 Subject: [PATCH] Message erreur si bul_intro_mail invalide --- app/scodoc/sco_bulletins.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index de7f28c9..ca6748de 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -1013,11 +1013,16 @@ def mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr): intro_mail = sco_preferences.get_preference("bul_intro_mail", formsemestre_id) if intro_mail: - hea = intro_mail % { - "nomprenom": etud["nomprenom"], - "dept": dept, - "webmaster": webmaster, - } + try: + hea = intro_mail % { + "nomprenom": etud["nomprenom"], + "dept": dept, + "webmaster": webmaster, + } + except KeyError as e: + raise ScoValueError( + "format 'Message d'accompagnement' (bul_intro_mail) invalide, revoir les réglages dans les préférences" + ) else: hea = ""