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 return render_template("error_csrf.j2", exc=exc), 404
def handle_pdf_format_error(exc): # def handle_pdf_format_error(exc):
return "ay ay ay" # return "ay ay ay"
handle_pdf_format_error = handle_sco_value_error
def internal_server_error(exc): def internal_server_error(exc):

View File

@ -46,6 +46,7 @@ from reportlab.lib.colors import Color
from app.models import FormSemestre from app.models import FormSemestre
from app.scodoc import codes_cursus 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_pv_dict
from app.scodoc import sco_pdf from app.scodoc import sco_pdf
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
@ -217,6 +218,7 @@ def _pvjury_pdf_type(
f"""<para align="center">Jury tenu le {date_jury}</para>""", style f"""<para align="center">Jury tenu le {date_jury}</para>""", style
) )
try:
objects += sco_pdf.make_paras( objects += sco_pdf.make_paras(
"<para>" "<para>"
+ (sco_preferences.get_preference("PV_INTRO", formsemestre.id) or "") + (sco_preferences.get_preference("PV_INTRO", formsemestre.id) or "")
@ -231,6 +233,8 @@ def _pvjury_pdf_type(
+ "</para>", + "</para>",
style_bullet, style_bullet,
) )
except KeyError as exc:
raise ScoPDFFormatError(msg=f"balise inconnue: {exc.args[0]}") from exc
objects += sco_pdf.make_paras( objects += sco_pdf.make_paras(
"""<para>Le jury propose les décisions suivantes :</para>""", style """<para>Le jury propose les décisions suivantes :</para>""", style

View File

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