From d1945b6190239480de5c0e4cf66938a15839dc4e Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 5 Dec 2018 04:34:49 -0400 Subject: [PATCH] OCR: Update app to use document image cache Update the OCR app to use the document image cache instead of trying to read the image file directly from the document storage. Signed-off-by: Roberto Rosario --- mayan/apps/ocr/managers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mayan/apps/ocr/managers.py b/mayan/apps/ocr/managers.py index d03b0dc071..f6a0b68978 100644 --- a/mayan/apps/ocr/managers.py +++ b/mayan/apps/ocr/managers.py @@ -8,7 +8,6 @@ from django.apps import apps from django.conf import settings from django.db import models -from mayan.apps.documents.storages import storage_documentimagecache from mayan.apps.documents.literals import DOCUMENT_IMAGE_TASK_TIMEOUT from mayan.apps.documents.tasks import task_generate_document_page_image @@ -38,7 +37,7 @@ class DocumentPageOCRContentManager(models.Manager): cache_filename = task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT) - with storage_documentimagecache.open(cache_filename) as file_object: + with document_page.cache_partition.get_file(filename=cache_filename).open() as file_object: document_page_content, created = DocumentPageOCRContent.objects.get_or_create( document_page=document_page )