mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-18 22:14:22 -06:00
Some random cleanups
This commit is contained in:
@@ -806,14 +806,7 @@ class ConsumerPreflightPlugin(
|
|||||||
or str(duplicate.pk)
|
or str(duplicate.pk)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
|
||||||
Path(self.input_doc.original_file).unlink()
|
Path(self.input_doc.original_file).unlink()
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
except Exception as exc: # pragma: no cover
|
|
||||||
self.log.warning(
|
|
||||||
f"Could not delete duplicate file {self.input_doc.original_file}: {exc}",
|
|
||||||
)
|
|
||||||
|
|
||||||
failure_msg = (
|
failure_msg = (
|
||||||
f"Not consuming {self.filename}: "
|
f"Not consuming {self.filename}: "
|
||||||
|
|||||||
@@ -2161,7 +2161,8 @@ class TasksViewSerializer(OwnedObjectSerializer):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_duplicate_documents(self, obj):
|
@extend_schema_field(DuplicateDocumentSummarySerializer(many=True))
|
||||||
|
def get_duplicate_documents(self, obj):
|
||||||
if not hasattr(self, "_duplicate_documents_cache"):
|
if not hasattr(self, "_duplicate_documents_cache"):
|
||||||
self._duplicate_documents_cache = {}
|
self._duplicate_documents_cache = {}
|
||||||
cache = self._duplicate_documents_cache
|
cache = self._duplicate_documents_cache
|
||||||
@@ -2182,10 +2183,6 @@ class TasksViewSerializer(OwnedObjectSerializer):
|
|||||||
cache[obj.pk] = list(duplicates.values("id", "title", "deleted_at"))
|
cache[obj.pk] = list(duplicates.values("id", "title", "deleted_at"))
|
||||||
return cache[obj.pk]
|
return cache[obj.pk]
|
||||||
|
|
||||||
@extend_schema_field(DuplicateDocumentSummarySerializer(many=True))
|
|
||||||
def get_duplicate_documents(self, obj):
|
|
||||||
return self._get_duplicate_documents(obj)
|
|
||||||
|
|
||||||
|
|
||||||
class RunTaskViewSerializer(serializers.Serializer):
|
class RunTaskViewSerializer(serializers.Serializer):
|
||||||
task_name = serializers.ChoiceField(
|
task_name = serializers.ChoiceField(
|
||||||
|
|||||||
Reference in New Issue
Block a user