A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
fix: Don't silently drop the change_groups and switch to a couple slightly more efficient implementations (#12431)
Trenton H8efb01010cf6
diff --git a/src/documents/consumer.py b/src/documents/consumer.pyindex 64622dc74..8f7efb0a2 100644--- a/src/documents/consumer.py+++ b/src/documents/consumer.py@@ -1,6 +1,7 @@import datetimeimport hashlibimport os+import shutilimport tempfilefrom enum import StrEnumfrom pathlib import Path@@ -824,7 +825,7 @@ class ConsumerPlugin(self.metadata.view_users is not Noneor self.metadata.view_groups is not Noneor self.metadata.change_users is not None- or self.metadata.change_users is not None+ or self.metadata.change_groups is not None):permissions = {"view": {@@ -857,7 +858,7 @@ class ConsumerPlugin(Path(source).open("rb") as read_file,Path(target).open("wb") as write_file,):- write_file.write(read_file.read())+ shutil.copyfileobj(read_file, write_file)# Attempt to copy file's original stats, but it's ok if we can'ttry:diff --git a/src/documents/tasks.py b/src/documents/tasks.pyindex 751990c62..20351a49d 100644--- a/src/documents/tasks.py+++ b/src/documents/tasks.py@@ -53,8 +53,8 @@ from documents.models import Tagfrom documents.models import WorkflowRunfrom documents.models import WorkflowTriggerfrom documents.plugins.base import ConsumeTaskPlugin-from documents.plugins.base import ProgressManagerfrom documents.plugins.base import StopConsumeTaskError+from documents.plugins.helpers import ProgressManagerfrom documents.plugins.helpers import ProgressStatusOptionsfrom documents.sanity_checker import SanityCheckFailedExceptionfrom documents.signals import document_updated@@ -533,13 +533,13 @@ def check_scheduled_workflows() -> None:id__in=matched_ids,)- if documents.count() > 0:+ if documents.exists():documents = prefilter_documents_by_workflowtrigger(documents,trigger,)- if documents.count() > 0:+ if documents.exists():logger.debug(f"Found {documents.count()} documents for trigger {trigger}",)