A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: replace strtobool
shamoon434b1e3245e4
diff --git a/src/documents/utils.py b/src/documents/utils.pyindex 04aa95bce..2b6a60749 100644--- a/src/documents/utils.py+++ b/src/documents/utils.py@@ -121,3 +121,10 @@ def run_subprocess(completed_proc.check_returncode()return completed_proc+++def get_boolean(boolstr: str) -> bool:+ """+ Return a boolean value from a string representation.+ """+ return bool(boolstr.lower() in ("yes", "y", "1", "t", "true"))diff --git a/src/documents/views.py b/src/documents/views.pyindex 4dc186260..74d1ff3ea 100644--- a/src/documents/views.py+++ b/src/documents/views.py@@ -6,7 +6,6 @@ import reimport tempfileimport zipfilefrom datetime import datetime-from distutils.util import strtoboolfrom pathlib import Pathfrom time import mktimefrom unicodedata import normalize@@ -169,6 +168,7 @@ from documents.tasks import index_optimizefrom documents.tasks import sanity_checkfrom documents.tasks import train_classifierfrom documents.templating.filepath import validate_filepath_template_and_render+from documents.utils import get_booleanfrom paperless import versionfrom paperless.celery import app as celery_appfrom paperless.config import GeneralConfig@@ -238,8 +238,8 @@ class PassUserMixin(GenericAPIView):def get_serializer(self, *args, **kwargs):kwargs.setdefault("user", self.request.user)try:- full_perms = bool(- strtobool(str(self.request.query_params.get("full_perms", "false"))),+ full_perms = get_boolean(+ str(self.request.query_params.get("full_perms", "false")),)except ValueError:full_perms = False@@ -600,8 +600,8 @@ class DocumentViewSet(kwargs.setdefault("fields", fields)kwargs.setdefault("truncate_content", truncate_content.lower() in ["true", "1"])try:- full_perms = bool(- strtobool(str(self.request.query_params.get("full_perms", "false"))),+ full_perms = get_boolean(+ str(self.request.query_params.get("full_perms", "false")),)except ValueError:full_perms = False