Améliore traitement erreurs dans champ PV intro PDF

This commit is contained in:
Emmanuel Viennet 2023-12-07 23:07:11 +01:00
parent a5c927db75
commit a70e6236d4
3 changed files with 22 additions and 17 deletions

View File

@ -86,8 +86,9 @@ def handle_invalid_csrf(exc):
return render_template("error_csrf.j2", exc=exc), 404
def handle_pdf_format_error(exc):
return "ay ay ay"
# def handle_pdf_format_error(exc):
# return "ay ay ay"
handle_pdf_format_error = handle_sco_value_error
def internal_server_error(exc):

View File

@ -46,6 +46,7 @@ from reportlab.lib.colors import Color
from app.models import FormSemestre
from app.scodoc import codes_cursus
from app.scodoc.sco_exceptions import ScoPDFFormatError
from app.scodoc import sco_pv_dict
from app.scodoc import sco_pdf
from app.scodoc import sco_preferences
@ -217,20 +218,23 @@ def _pvjury_pdf_type(
f"""<para align="center">Jury tenu le {date_jury}</para>""", style
)
objects += sco_pdf.make_paras(
"<para>"
+ (sco_preferences.get_preference("PV_INTRO", formsemestre.id) or "")
% {
"Decnum": numero_arrete,
"VDICode": code_vdi,
"UnivName": sco_preferences.get_preference("UnivName", formsemestre.id),
"Type": titre_jury,
"Date": date_commission, # deprecated
"date_commission": date_commission,
}
+ "</para>",
style_bullet,
)
try:
objects += sco_pdf.make_paras(
"<para>"
+ (sco_preferences.get_preference("PV_INTRO", formsemestre.id) or "")
% {
"Decnum": numero_arrete,
"VDICode": code_vdi,
"UnivName": sco_preferences.get_preference("UnivName", formsemestre.id),
"Type": titre_jury,
"Date": date_commission, # deprecated
"date_commission": date_commission,
}
+ "</para>",
style_bullet,
)
except KeyError as exc:
raise ScoPDFFormatError(msg=f"balise inconnue: {exc.args[0]}") from exc
objects += sco_pdf.make_paras(
"""<para>Le jury propose les décisions suivantes :</para>""", style

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.6.65"
SCOVERSION = "9.6.66"
SCONAME = "ScoDoc"