A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
fixup: remove helper fn 'make_dirs'
Erik Arvstedtbccac5017c29
diff --git a/src/documents/consumer.py b/src/documents/consumer.pyindex cca7c1c13..37151d1b4 100644--- a/src/documents/consumer.py+++ b/src/documents/consumer.py@@ -48,7 +48,7 @@ class Consumer:self.consume = consumeself.scratch = scratch- make_dirs(self.scratch)+ os.makedirs(self.scratch, exists_ok=True)if not self.consume:raise ConsumerError(@@ -247,11 +247,3 @@ class Consumer:with open(doc, "rb") as f:checksum = hashlib.md5(f.read()).hexdigest()return Document.objects.filter(checksum=checksum).exists()---def make_dirs(*dirs):- for dir in dirs:- try:- os.makedirs(dir)- except FileExistsError:- passdiff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.pyindex a0e2f00fe..4bf403318 100644--- a/src/documents/management/commands/document_consumer.py+++ b/src/documents/management/commands/document_consumer.py@@ -7,7 +7,7 @@ import timefrom django.conf import settingsfrom django.core.management.base import BaseCommand, CommandError-from ...consumer import Consumer, ConsumerError, make_dirs+from ...consumer import Consumer, ConsumerErrorfrom ...mail import MailFetcher, MailFetcherErrortry:@@ -80,7 +80,8 @@ class Command(BaseCommand):except (ConsumerError, MailFetcherError) as e:raise CommandError(e)- make_dirs(self.ORIGINAL_DOCS, self.THUMB_DOCS)+ for d in (self.ORIGINAL_DOCS, self.THUMB_DOCS):+ os.makedirs(d, exists_ok=True)logging.getLogger(__name__).info("Starting document consumer at {}{}".format(