From 88b06f11d02d5399e68c24b9ca34179a29e32846 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 14 Feb 2023 17:28:25 +0100 Subject: [PATCH] PDF: meilleure gestion d'erreur si police invalide --- app/scodoc/sco_pdf.py | 14 +++++++++++--- sco_version.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/scodoc/sco_pdf.py b/app/scodoc/sco_pdf.py index e427b717d..7fca1e679 100755 --- a/app/scodoc/sco_pdf.py +++ b/app/scodoc/sco_pdf.py @@ -320,9 +320,17 @@ class ScoDocPageTemplate(PageTemplate): def draw_footer(self, canv, content): """Print the footer""" - canv.setFont( - self.preferences["SCOLAR_FONT"], self.preferences["SCOLAR_FONT_SIZE_FOOT"] - ) + try: + canv.setFont( + self.preferences["SCOLAR_FONT"], + self.preferences["SCOLAR_FONT_SIZE_FOOT"], + ) + except KeyError as exc: + raise ScoValueError( + f"""Police invalide dans pied de page pdf: { + self.preferences['SCOLAR_FONT'] + } (taille {self.preferences['SCOLAR_FONT_SIZE_FOOT']})""" + ) from exc canv.drawString( self.preferences["pdf_footer_x"] * mm, self.preferences["pdf_footer_y"] * mm, diff --git a/sco_version.py b/sco_version.py index 254a85573..7ab740762 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.43" +SCOVERSION = "9.4.44" SCONAME = "ScoDoc"