From 03d23cfaabaf88630412dcc4a1c4996efc33903d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 16 Mar 2023 15:16:04 +0100 Subject: [PATCH] Fix archive (dup requests), + fix broken link --- app/scodoc/sco_archives.py | 7 +++++-- app/scodoc/sco_pv_forms.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 839780fe..55d7b068 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -220,15 +220,18 @@ class BaseArchiver(object): def create_obj_archive(self, oid: int, description: str): """Creates a new archive for this object and returns its id.""" + # id suffixé par YYYY-MM-DD-hh-mm-ss archive_id = ( self.get_obj_dir(oid) + os.path.sep - + "-".join(["%02d" % x for x in time.localtime()[:6]]) + + "-".join(["{x:02d}" for x in time.localtime()[:6]]) ) log(f"creating archive: {archive_id}") try: scu.GSL.acquire() - os.mkdir(archive_id) # if exists, raises FileExistsError + os.mkdir(archive_id) + except FileExistsError: # directory already exists ! + pass finally: scu.GSL.release() self.store(archive_id, "_description.txt", description) diff --git a/app/scodoc/sco_pv_forms.py b/app/scodoc/sco_pv_forms.py index af6cb65b..a60a88ca 100644 --- a/app/scodoc/sco_pv_forms.py +++ b/app/scodoc/sco_pv_forms.py @@ -333,7 +333,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid # PV pour ce seul étudiant: etud = Identite.query.get_or_404(etudid) etuddescr = f"""{etud.nomprenom}""" etudids = [etudid] else: