Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Smarter check positions

Daniel Quinn65074b437562
diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py
index 63d680078..b0cbb7aa7 100644
--- a/src/documents/management/commands/document_consumer.py
+++ b/src/documents/management/commands/document_consumer.py
@@ -61,10 +61,6 @@ class Command(BaseCommand):
self.verbosity = options["verbosity"]
- if not os.path.exists(self.CONSUME):
- raise CommandError("Consumption directory {} does not exist".format(
- self.CONSUME))
-
self._setup()
try:
@@ -109,6 +105,17 @@ class Command(BaseCommand):
self._cleanup(pngs, pdf)
def _setup(self):
+
+ if not self.CONSUME:
+ raise CommandError(
+ "The CONSUMPTION_DIR settings variable does not appear to be "
+ "set."
+ )
+
+ if not os.path.exists(self.CONSUME):
+ raise CommandError("Consumption directory {} does not exist".format(
+ self.CONSUME))
+
for d in (self.SCRATCH, self.MEDIA_PDF):
try:
os.makedirs(d)
@@ -147,7 +154,7 @@ class Command(BaseCommand):
def _get_ocr(self, pngs):
- self._render(" OCRing the PDF", 1)
+ self._render(" OCRing the PDF", 2)
raw_text = self._ocr(pngs, self.DEFAULT_OCR_LANGUAGE)