Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
Showing only changes of commit 5f49355ec3 - Show all commits

View File

@ -157,15 +157,15 @@ class JustificatifArchiver(BaseArchiver):
Si trace == True : sauvegarde le nom du/des fichier(s) supprimé(s) Si trace == True : sauvegarde le nom du/des fichier(s) supprimé(s)
dans la trace de l'étudiant dans la trace de l'étudiant
""" """
print("debug : ", archive_name, filename, has_trace) log(f"debug : {archive_name}{filename} {has_trace}")
if str(etud.id) not in self.list_oids(etud.dept_id): if str(etud.id) not in self.list_oids(etud.dept_id):
raise ValueError(f"Aucune archive pour etudid[{etud.id}]") raise ValueError(f"Aucune archive pour etudid[{etud.id}]")
try: try:
archive_id = self.get_id_from_name( archive_id = self.get_id_from_name(
etud.id, archive_name, dept_id=etud.dept_id etud.id, archive_name, dept_id=etud.dept_id
) )
except ScoValueError: except ScoValueError as exc:
raise ValueError(f"Archive Inconnue [{archive_name}]") raise ValueError(f"Archive Inconnue [{archive_name}]") from exc
if filename is not None: if filename is not None:
if filename not in self.list_archive(archive_id, dept_id=etud.dept_id): if filename not in self.list_archive(archive_id, dept_id=etud.dept_id):
@ -183,6 +183,7 @@ class JustificatifArchiver(BaseArchiver):
trace = Trace(archive_id) trace = Trace(archive_id)
trace.set_trace(filename, mode="delete") trace.set_trace(filename, mode="delete")
os.remove(path) os.remove(path)
log(f"delete_justificatif: removed {path}")
else: else:
if has_trace: if has_trace:
@ -197,6 +198,7 @@ class JustificatifArchiver(BaseArchiver):
archive_id, archive_id,
) )
) )
log(f"delete_justificatif: deleted archive {archive_id}")
def list_justificatifs( def list_justificatifs(
self, archive_name: str, etud: Identite self, archive_name: str, etud: Identite