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 d21af70abb - Show all commits

View File

@ -270,6 +270,10 @@ class BaseArchiver:
fname = os.path.join(archive_id, filename) fname = os.path.join(archive_id, filename)
with open(fname, "wb") as f: with open(fname, "wb") as f:
f.write(data) f.write(data)
except FileNotFoundError as exc:
raise ScoValueError(
f"Erreur stockage archive (dossier inexistant, chemin {fname})"
) from exc
finally: finally:
scu.GSL.release() scu.GSL.release()
return filename return filename
@ -282,8 +286,13 @@ class BaseArchiver:
raise ScoValueError("archive introuvable (déjà supprimée ?)") raise ScoValueError("archive introuvable (déjà supprimée ?)")
fname = os.path.join(archive_id, filename) fname = os.path.join(archive_id, filename)
log(f"reading archive file {fname}") log(f"reading archive file {fname}")
with open(fname, "rb") as f: try:
data = f.read() with open(fname, "rb") as f:
data = f.read()
except FileNotFoundError as exc:
raise ScoValueError(
f"Erreur lecture archive (inexistant, chemin {fname})"
) from exc
return data return data
def get_archived_file(self, oid, archive_name, filename, dept_id: int = None): def get_archived_file(self, oid, archive_name, filename, dept_id: int = None):