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:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user