forked from ScoDoc/ScoDoc
Améliore traitement erreurs archives
This commit is contained in:
parent
c65bbc3872
commit
d21af70abb
@ -270,6 +270,10 @@ class BaseArchiver:
|
||||
fname = os.path.join(archive_id, filename)
|
||||
with open(fname, "wb") as f:
|
||||
f.write(data)
|
||||
except FileNotFoundError as exc:
|
||||
raise ScoValueError(
|
||||
f"Erreur stockage archive (dossier inexistant, chemin {fname})"
|
||||
) from exc
|
||||
finally:
|
||||
scu.GSL.release()
|
||||
return filename
|
||||
@ -282,8 +286,13 @@ class BaseArchiver:
|
||||
raise ScoValueError("archive introuvable (déjà supprimée ?)")
|
||||
fname = os.path.join(archive_id, filename)
|
||||
log(f"reading archive file {fname}")
|
||||
with open(fname, "rb") as f:
|
||||
data = f.read()
|
||||
try:
|
||||
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
|
||||
|
||||
def get_archived_file(self, oid, archive_name, filename, dept_id: int = None):
|
||||
|
Loading…
Reference in New Issue
Block a user