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 <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-12-05 04:34:49 -04:00
parent c466c44dfb
commit d1945b6190

View File

@@ -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
)