forked from ScoDoc/ScoDoc
logs et exceptions
This commit is contained in:
parent
892d1e9967
commit
5f49355ec3
@ -157,15 +157,15 @@ class JustificatifArchiver(BaseArchiver):
|
||||
Si trace == True : sauvegarde le nom du/des fichier(s) supprimé(s)
|
||||
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):
|
||||
raise ValueError(f"Aucune archive pour etudid[{etud.id}]")
|
||||
try:
|
||||
archive_id = self.get_id_from_name(
|
||||
etud.id, archive_name, dept_id=etud.dept_id
|
||||
)
|
||||
except ScoValueError:
|
||||
raise ValueError(f"Archive Inconnue [{archive_name}]")
|
||||
except ScoValueError as exc:
|
||||
raise ValueError(f"Archive Inconnue [{archive_name}]") from exc
|
||||
|
||||
if filename is not None:
|
||||
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.set_trace(filename, mode="delete")
|
||||
os.remove(path)
|
||||
log(f"delete_justificatif: removed {path}")
|
||||
|
||||
else:
|
||||
if has_trace:
|
||||
@ -197,6 +198,7 @@ class JustificatifArchiver(BaseArchiver):
|
||||
archive_id,
|
||||
)
|
||||
)
|
||||
log(f"delete_justificatif: deleted archive {archive_id}")
|
||||
|
||||
def list_justificatifs(
|
||||
self, archive_name: str, etud: Identite
|
||||
|
Loading…
Reference in New Issue
Block a user