From 001e40d6331167542cfe1895c62d4e53bc2ef6e7 Mon Sep 17 00:00:00 2001 From: Wolf-Bastian Poettner Date: Mon, 13 Apr 2020 13:31:29 +0000 Subject: [PATCH] Fix: made try_delete_empty_directories and delete_all_empty_subdirectories staticmethods --- src/documents/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/documents/models.py b/src/documents/models.py index 9099803cf..368d0f46c 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -311,7 +311,8 @@ class Document(models.Model): self.filename = recovered_filename self.save() - delete_all_empty_subdirectories(Document.filename_to_path("")) + Document.delete_all_empty_subdirectories( + Document.filename_to_path("")) return self.filename @@ -427,7 +428,6 @@ class Document(models.Model): if os.path.isfile(Document.filename_to_path(filename)): self.filename = filename - @staticmethod def try_delete_empty_directories(directory): # Go up in the directory hierarchy and try to delete all directories @@ -446,7 +446,6 @@ class Document(models.Model): directory, _ = os.path.split(directory) directory = os.path.normpath(directory) - @staticmethod def delete_all_empty_subdirectories(directory): # Go through all folders and try to delete all directories @@ -459,7 +458,8 @@ class Document(models.Model): continue # Go into subdirectory to see, if there is more to delete - Document.delete_all_empty_subdirectories(os.path.join(directory, filename)) + Document.delete_all_empty_subdirectories( + os.path.join(directory, filename)) # Try to delete the directory try: