Replace all __unicode__ methods to __str__ and the @python_2_unicode_compatible decorator. Replace all instance of smart_str, smart_unicode, force_uncode with force_text. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
15 lines
423 B
Python
15 lines
423 B
Python
from __future__ import unicode_literals
|
|
|
|
from django.utils.encoding import force_text
|
|
from django.utils.html import conditional_escape
|
|
|
|
|
|
def get_document_ocr_content(document):
|
|
for page in document.pages.all():
|
|
try:
|
|
page_content = page.ocr_content.content
|
|
except DocumentPageContent.DoesNotExist:
|
|
pass
|
|
else:
|
|
yield conditional_escape(force_text(page_content))
|