|
|
|
@ -122,12 +122,19 @@ class RevocationDocument(AbstractDocument):
|
|
|
|
|
|
|
|
|
|
# Always remove 'revocation' folder
|
|
|
|
|
folder_path = self.file.path.split("/")
|
|
|
|
|
shutil.rmtree("/".join(folder_path[:-1]))
|
|
|
|
|
try:
|
|
|
|
|
shutil.rmtree("/".join(folder_path[:-1]))
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
# Revocation subfolder seems to be missing already
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
if other_intervention_docs.count() == 0:
|
|
|
|
|
# If there are no further documents for the intervention, we can simply remove the whole folder as well!
|
|
|
|
|
shutil.rmtree("/".join(folder_path[:-2]))
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
shutil.rmtree("/".join(folder_path[:-2]))
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
# Folder seems to be missing already
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
class LegalData(UuidModel):
|
|
|
|
|
"""
|
|
|
|
@ -415,5 +422,8 @@ class InterventionDocument(AbstractDocument):
|
|
|
|
|
|
|
|
|
|
# If a folder path has been set, we need to delete the whole folder!
|
|
|
|
|
if folder_path is not None:
|
|
|
|
|
shutil.rmtree(folder_path)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
shutil.rmtree(folder_path)
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
# Folder seems to be missing already...
|
|
|
|
|
pass
|
|
|
|
|