", text) return text @@ -219,7 +219,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"): for etud in formsemestre.get_inscrits(include_demdef=True, order=True): frag, _ = sco_bulletins.do_formsemestre_bulletinetud( formsemestre, - etud.id, + etud, format="pdfpart", version=version, ) @@ -256,22 +256,21 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"): "Bulletins pdf de tous les semestres de l'étudiant, et filename" from app.scodoc import sco_bulletins - etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] + etud: Identite = Identite.query.get_or_404(etudid) fragments = [] bookmarks = {} filigrannes = {} i = 1 - for sem in etud["sems"]: - formsemestre = FormSemestre.query.get(sem["formsemestre_id"]) + for formsemestre in etud.get_formsemestres(): frag, filigranne = sco_bulletins.do_formsemestre_bulletinetud( formsemestre, - etudid, + etud, format="pdfpart", version=version, ) fragments += frag filigrannes[i] = filigranne - bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015 + bookmarks[i] = formsemestre.session_id() # eg RT-DUT-FI-S1-2015 i = i + 1 infos = {"DeptName": sco_preferences.get_preference("DeptName")} if request: @@ -283,7 +282,7 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"): pdfdoc = assemble_bulletins_pdf( None, fragments, - etud["nomprenom"], + etud.nomprenom, infos, bookmarks, filigranne=filigrannes, @@ -292,7 +291,7 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"): finally: sco_pdf.PDFLOCK.release() # - filename = "bul-%s" % (etud["nomprenom"]) + filename = f"bul-{etud.nomprenom}" filename = ( scu.unescape_html(filename).replace(" ", "_").replace("&", "").replace(".", "") + ".pdf" diff --git a/app/scodoc/sco_bulletins_standard.py b/app/scodoc/sco_bulletins_standard.py index da854cbe..c7c51135 100644 --- a/app/scodoc/sco_bulletins_standard.py +++ b/app/scodoc/sco_bulletins_standard.py @@ -186,13 +186,13 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): self.preferences["bul_pdf_caption"], self.infos, self.FieldStyle, - format="pdf", + fmt="pdf", ) field = sco_bulletins_pdf.process_field( self.preferences["bul_pdf_caption"], self.infos, self.FieldStyle, - format="html", + fmt="html", ) H.append('