From 398f6e5b0c5379cc1b912217d0920037dd3ff388 Mon Sep 17 00:00:00 2001 From: Trenton Holmes Date: Tue, 14 Jun 2022 07:07:44 -0700 Subject: [PATCH] Removes variable which was never set, removed unneeded serializer method --- src/documents/serialisers.py | 4 ---- src/documents/tasks.py | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index 915b26abc..53f9f644a 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -573,10 +573,6 @@ class StoragePathSerializer(MatchingModelSerializer): return path - def create(self, validated_data): - storage_path = StoragePath.objects.create(**validated_data) - return storage_path - class UiSettingsViewSerializer(serializers.ModelSerializer): class Meta: diff --git a/src/documents/tasks.py b/src/documents/tasks.py index b27ecd1dd..a33dc4e29 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -93,7 +93,6 @@ def consume_file( else: separators = [] document_list = [] - converted_tiff = None if mime_type == "image/tiff": file_to_process = barcodes.convert_from_tiff_to_pdf(path) @@ -117,13 +116,17 @@ def consume_file( else: newname = None barcodes.save_to_dir(document, newname=newname) + # if we got here, the document was successfully split # and can safely be deleted - if converted_tiff is not None: + if mime_type == "image/tiff": + # Remove the TIFF converted to PDF file logger.debug(f"Deleting file {file_to_process}") os.unlink(file_to_process) + # Remove the original file (new file is saved above) logger.debug(f"Deleting file {path}") os.unlink(path) + # notify the sender, otherwise the progress bar # in the UI stays stuck payload = {