From 0db3acf2719ed4f1c1a27c0d298273884e688753 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Fri, 8 Jul 2022 15:11:45 +0200 Subject: [PATCH] fix des diff avec le master --- app/scodoc/sco_bulletins_legacy.py | 11 ++++------- app/scodoc/sco_bulletins_pdf.py | 4 ++-- app/scodoc/sco_logos.py | 8 ++------ app/scodoc/sco_moduleimpl_inscriptions.py | 9 +++------ 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/app/scodoc/sco_bulletins_legacy.py b/app/scodoc/sco_bulletins_legacy.py index 1dc01ad5..314abb0d 100644 --- a/app/scodoc/sco_bulletins_legacy.py +++ b/app/scodoc/sco_bulletins_legacy.py @@ -132,13 +132,10 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator): if sco_preferences.get_preference( "bul_show_minmax_mod", formsemestre_id ): - rang_minmax = ( - '%s [%s, %s]' - % ( - mod["mod_rang_txt"], - scu.fmt_note(mod["stats"]["min"]), - scu.fmt_note(mod["stats"]["max"]), - ) + rang_minmax = '%s [%s, %s]' % ( + mod["mod_rang_txt"], + scu.fmt_note(mod["stats"]["min"]), + scu.fmt_note(mod["stats"]["max"]), ) else: rang_minmax = mod["mod_rang_txt"] # vide si pas option rang diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py index e0ac4e14..501bd98c 100644 --- a/app/scodoc/sco_bulletins_pdf.py +++ b/app/scodoc/sco_bulletins_pdf.py @@ -75,7 +75,7 @@ import sco_version def assemble_bulletins_pdf( formsemestre_id: int, - story, + story: list, bul_title: str, infos, pagesbookmarks=None, @@ -107,7 +107,7 @@ def assemble_bulletins_pdf( preferences=sco_preferences.SemPreferences(formsemestre_id), ) ) - document.build(story) + document.multiBuild(story) data = report.getvalue() return data diff --git a/app/scodoc/sco_logos.py b/app/scodoc/sco_logos.py index 343c4c46..27ce7573 100644 --- a/app/scodoc/sco_logos.py +++ b/app/scodoc/sco_logos.py @@ -121,8 +121,7 @@ def _list_dept_logos(dept_id=None, prefix=scu.LOGO_FILE_PREFIX): :return: le résultat de la recherche ou None si aucune image trouvée """ allowed_ext = "|".join(scu.LOGOS_IMAGES_ALLOWED_TYPES) - # parse filename 'logo_. . be carefull: logoname may include '.' - filename_parser = re.compile(f"{prefix}(([^.]*.)+)({allowed_ext})") + filename_parser = re.compile(f"{prefix}([^.]*).({allowed_ext})") logos = {} path_dir = Path(scu.SCODOC_LOGOS_DIR) if dept_id: @@ -136,7 +135,7 @@ def _list_dept_logos(dept_id=None, prefix=scu.LOGO_FILE_PREFIX): if os.access(path_dir.joinpath(entry).absolute(), os.R_OK): result = filename_parser.match(entry.name) if result: - logoname = result.group(1)[:-1] # retreive logoname from filename (less final dot) + logoname = result.group(1) logos[logoname] = Logo(logoname=logoname, dept_id=dept_id).select() return logos if len(logos.keys()) > 0 else None @@ -192,9 +191,6 @@ class Logo: ) self.mm = "Not initialized: call the select or create function before access" - def __repr__(self) -> str: - return f"Logo(logoname='{self.logoname}', filename='{self.filename}')" - def _set_format(self, fmt): self.suffix = fmt self.filepath = self.basepath + "." + fmt diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index ce706318..76871cf3 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -303,12 +303,9 @@ def moduleimpl_inscriptions_stats(formsemestre_id): ) for mod in options: if can_change: - c_link = ( - '%s' - % ( - mod["moduleimpl_id"], - mod["descri"] or "(inscrire des étudiants)", - ) + c_link = '%s' % ( + mod["moduleimpl_id"], + mod["descri"] or "(inscrire des étudiants)", ) else: c_link = mod["descri"]