Merge branch 'release/v0.12'
Conflicts: apps/documents/models.py apps/history/api.py apps/ocr/__init__.py
This commit is contained in:
@@ -1,45 +1,33 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from django.db import transaction
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext
|
||||
from django.db.utils import DatabaseError
|
||||
from django.db.models.signals import post_save, post_syncdb
|
||||
from django.dispatch import receiver
|
||||
from django.db.utils import DatabaseError
|
||||
|
||||
from navigation.api import register_links, register_top_menu, register_multi_item_links
|
||||
from permissions.api import register_permission, set_namespace_title
|
||||
from documents.models import Document
|
||||
from navigation.api import register_links, register_multi_item_links
|
||||
from documents.models import Document, DocumentVersion
|
||||
from main.api import register_maintenance_links
|
||||
from project_tools.api import register_tool
|
||||
from acls.api import class_permissions
|
||||
|
||||
from scheduler.api import register_interval_job
|
||||
|
||||
from ocr.conf.settings import AUTOMATIC_OCR
|
||||
from ocr.conf.settings import QUEUE_PROCESSING_INTERVAL
|
||||
from ocr.models import DocumentQueue, QueueTransformation, QueueDocument
|
||||
from ocr.tasks import task_process_document_queues
|
||||
from ocr import models as ocr_models
|
||||
from .conf.settings import (AUTOMATIC_OCR, QUEUE_PROCESSING_INTERVAL)
|
||||
from .models import DocumentQueue, QueueTransformation
|
||||
from .tasks import task_process_document_queues
|
||||
from .permissions import (PERMISSION_OCR_DOCUMENT,
|
||||
PERMISSION_OCR_DOCUMENT_DELETE, PERMISSION_OCR_QUEUE_ENABLE_DISABLE,
|
||||
PERMISSION_OCR_CLEAN_ALL_PAGES)
|
||||
from .exceptions import AlreadyQueued
|
||||
from . import models as ocr_models
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
#Permissions
|
||||
PERMISSION_OCR_DOCUMENT = {'namespace': 'ocr', 'name': 'ocr_document', 'label': _(u'Submit document for OCR')}
|
||||
PERMISSION_OCR_DOCUMENT_DELETE = {'namespace': 'ocr', 'name': 'ocr_document_delete', 'label': _(u'Delete document for OCR queue')}
|
||||
PERMISSION_OCR_QUEUE_ENABLE_DISABLE = {'namespace': 'ocr', 'name': 'ocr_queue_enable_disable', 'label': _(u'Can enable/disable an OCR queue')}
|
||||
PERMISSION_OCR_CLEAN_ALL_PAGES = {'namespace': 'ocr', 'name': 'ocr_clean_all_pages', 'label': _(u'Can execute an OCR clean up on all document pages')}
|
||||
PERMISSION_OCR_QUEUE_EDIT = {'namespace': 'ocr_setup', 'name': 'ocr_queue_edit', 'label': _(u'Can edit an OCR queue properties')}
|
||||
|
||||
set_namespace_title('ocr', _(u'OCR'))
|
||||
register_permission(PERMISSION_OCR_DOCUMENT)
|
||||
register_permission(PERMISSION_OCR_DOCUMENT_DELETE)
|
||||
register_permission(PERMISSION_OCR_QUEUE_ENABLE_DISABLE)
|
||||
register_permission(PERMISSION_OCR_CLEAN_ALL_PAGES)
|
||||
|
||||
set_namespace_title('ocr_setup', _(u'OCR Setup'))
|
||||
register_permission(PERMISSION_OCR_QUEUE_EDIT)
|
||||
|
||||
#Links
|
||||
submit_document = {'text': _('submit to OCR queue'), 'view': 'submit_document', 'args': 'object.id', 'famfam': 'hourglass_add', 'permissions': [PERMISSION_OCR_DOCUMENT]}
|
||||
submit_document_multiple = {'text': _('submit to OCR queue'), 'view': 'submit_document_multiple', 'famfam': 'hourglass_add', 'permissions': [PERMISSION_OCR_DOCUMENT]}
|
||||
@@ -54,9 +42,7 @@ document_queue_enable = {'text': _(u'activate queue'), 'view': 'document_queue_e
|
||||
all_document_ocr_cleanup = {'text': _(u'clean up pages content'), 'view': 'all_document_ocr_cleanup', 'famfam': 'text_strikethrough', 'permissions': [PERMISSION_OCR_CLEAN_ALL_PAGES], 'description': _(u'Runs a language filter to remove common OCR mistakes from document pages content.')}
|
||||
|
||||
queue_document_list = {'text': _(u'queue document list'), 'view': 'queue_document_list', 'famfam': 'hourglass', 'permissions': [PERMISSION_OCR_DOCUMENT]}
|
||||
ocr_tool_link = {'text': _(u'OCR'), 'view': 'queue_document_list', 'famfam': 'hourglass', 'icon': 'text.png', 'permissions': [PERMISSION_OCR_DOCUMENT]}
|
||||
|
||||
node_active_list = {'text': _(u'active tasks'), 'view': 'node_active_list', 'famfam': 'server_chart', 'permissions': [PERMISSION_OCR_DOCUMENT]}
|
||||
ocr_tool_link = {'text': _(u'OCR'), 'view': 'queue_document_list', 'famfam': 'hourglass', 'icon': 'text.png', 'permissions': [PERMISSION_OCR_DOCUMENT], 'children_view_regex': [r'queue_', r'document_queue']}
|
||||
|
||||
setup_queue_transformation_list = {'text': _(u'transformations'), 'view': 'setup_queue_transformation_list', 'args': 'queue.pk', 'famfam': 'shape_move_front'}
|
||||
setup_queue_transformation_create = {'text': _(u'add transformation'), 'view': 'setup_queue_transformation_create', 'args': 'queue.pk', 'famfam': 'shape_square_add'}
|
||||
@@ -71,7 +57,7 @@ register_links(QueueTransformation, [setup_queue_transformation_edit, setup_queu
|
||||
|
||||
register_multi_item_links(['queue_document_list'], [re_queue_multiple_document, queue_document_multiple_delete])
|
||||
|
||||
register_links(['setup_queue_transformation_create', 'setup_queue_transformation_edit', 'setup_queue_transformation_delete', 'document_queue_disable', 'document_queue_enable', 'queue_document_list', 'node_active_list', 'setup_queue_transformation_list'], [queue_document_list, node_active_list], menu_name='secondary_menu')
|
||||
register_links(['setup_queue_transformation_create', 'setup_queue_transformation_edit', 'setup_queue_transformation_delete', 'document_queue_disable', 'document_queue_enable', 'queue_document_list', 'setup_queue_transformation_list'], [queue_document_list], menu_name='secondary_menu')
|
||||
register_links(['setup_queue_transformation_edit', 'setup_queue_transformation_delete', 'setup_queue_transformation_list', 'setup_queue_transformation_create'], [setup_queue_transformation_create], menu_name='sidebar')
|
||||
|
||||
register_maintenance_links([all_document_ocr_cleanup], namespace='ocr', title=_(u'OCR'))
|
||||
@@ -79,26 +65,33 @@ register_maintenance_links([all_document_ocr_cleanup], namespace='ocr', title=_(
|
||||
|
||||
@transaction.commit_on_success
|
||||
def create_default_queue():
|
||||
default_queue, created = DocumentQueue.objects.get_or_create(name='default')
|
||||
if created:
|
||||
default_queue.label = ugettext(u'Default')
|
||||
default_queue.save()
|
||||
try:
|
||||
default_queue, created = DocumentQueue.objects.get_or_create(name='default')
|
||||
except DatabaseError:
|
||||
transaction.rollback()
|
||||
else:
|
||||
if created:
|
||||
default_queue.label = ugettext(u'Default')
|
||||
default_queue.save()
|
||||
|
||||
|
||||
@receiver(post_save, dispatch_uid='document_post_save', sender=DocumentVersion)
|
||||
def document_post_save(sender, instance, **kwargs):
|
||||
logger.debug('received post save signal')
|
||||
logger.debug('instance: %s' % instance)
|
||||
if kwargs.get('created', False):
|
||||
if AUTOMATIC_OCR:
|
||||
DocumentQueue.objects.queue_document(instance)
|
||||
|
||||
post_save.connect(document_post_save, sender=Document)
|
||||
|
||||
try:
|
||||
DocumentQueue.objects.queue_document(instance.document)
|
||||
except AlreadyQueued:
|
||||
pass
|
||||
|
||||
# Disabled because it appears Django execute signals using the same
|
||||
# process effectively blocking the view until the OCR process completes
|
||||
# which could take several minutes :/
|
||||
# process of the signal emiter effectively blocking the view until
|
||||
# the OCR process completes which could take several minutes :/
|
||||
#@receiver(post_save, dispatch_uid='call_queue', sender=QueueDocument)
|
||||
#def call_queue(sender, **kwargs):
|
||||
# if kwargs.get('created', False):
|
||||
# if kwargs.get('created', False):
|
||||
# logger.debug('got call_queue signal: %s' % kwargs)
|
||||
# task_process_document_queues()
|
||||
|
||||
@@ -109,3 +102,7 @@ def create_default_queue_signal_handler(sender, **kwargs):
|
||||
register_interval_job('task_process_document_queues', _(u'Checks the OCR queue for pending documents.'), task_process_document_queues, seconds=QUEUE_PROCESSING_INTERVAL)
|
||||
|
||||
register_tool(ocr_tool_link)
|
||||
|
||||
class_permissions(Document, [
|
||||
PERMISSION_OCR_DOCUMENT,
|
||||
])
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Some code from http://wiki.github.com/hoffstaetter/python-tesseract
|
||||
from __future__ import absolute_import
|
||||
|
||||
import codecs
|
||||
import os
|
||||
@@ -13,14 +14,12 @@ from common.conf.settings import TEMPORARY_DIRECTORY
|
||||
from converter.api import convert
|
||||
from documents.models import DocumentPage
|
||||
|
||||
from ocr.conf.settings import TESSERACT_PATH
|
||||
from ocr.conf.settings import TESSERACT_LANGUAGE
|
||||
from ocr.exceptions import TesseractError, UnpaperError
|
||||
from ocr.conf.settings import UNPAPER_PATH
|
||||
from ocr.parsers import parse_document_page
|
||||
from ocr.parsers.exceptions import ParserError, ParserUnknownFile
|
||||
from ocr.literals import DEFAULT_OCR_FILE_FORMAT, UNPAPER_FILE_FORMAT, \
|
||||
DEFAULT_OCR_FILE_EXTENSION
|
||||
from .conf.settings import (TESSERACT_PATH, TESSERACT_LANGUAGE, UNPAPER_PATH)
|
||||
from .exceptions import TesseractError, UnpaperError
|
||||
from .parsers import parse_document_page
|
||||
from .parsers.exceptions import ParserError, ParserUnknownFile
|
||||
from .literals import (DEFAULT_OCR_FILE_FORMAT, UNPAPER_FILE_FORMAT,
|
||||
DEFAULT_OCR_FILE_EXTENSION)
|
||||
|
||||
|
||||
def get_language_backend():
|
||||
|
||||
@@ -14,7 +14,6 @@ register_settings(
|
||||
{'name': u'NODE_CONCURRENT_EXECUTION', 'global_name': u'OCR_NODE_CONCURRENT_EXECUTION', 'default': 1, 'description': _(u'Maximum amount of concurrent document OCRs a node can perform.')},
|
||||
{'name': u'AUTOMATIC_OCR', 'global_name': u'OCR_AUTOMATIC_OCR', 'default': False, 'description': _(u'Automatically queue newly created documents for OCR.')},
|
||||
{'name': u'QUEUE_PROCESSING_INTERVAL', 'global_name': u'OCR_QUEUE_PROCESSING_INTERVAL', 'default': 10},
|
||||
{'name': u'CACHE_URI', 'global_name': u'OCR_CACHE_URI', 'default': None, 'description': _(u'URI in the form: "memcached://127.0.0.1:11211/" to specify a cache backend to use for locking. Multiple hosts can be specified separated by a semicolon.')},
|
||||
{'name': u'UNPAPER_PATH', 'global_name': u'OCR_UNPAPER_PATH', 'default': u'/usr/bin/unpaper', 'description': _(u'File path to unpaper program.'), 'exists': True},
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
class AlreadyQueued(Exception):
|
||||
"""
|
||||
Raised when a trying to queue document already in the queue
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class TesseractError(Exception):
|
||||
"""
|
||||
Raised by tesseract
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
|
||||
"POT-Creation-Date: 2012-02-12 15:20-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -17,93 +17,65 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: __init__.py:28
|
||||
msgid "Submit document for OCR"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:29
|
||||
msgid "Delete document for OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:30
|
||||
msgid "Can enable/disable an OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:31
|
||||
msgid "Can execute an OCR clean up on all document pages"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:32
|
||||
msgid "Can edit an OCR queue properties"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:34 __init__.py:56 __init__.py:74
|
||||
msgid "OCR"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:40
|
||||
msgid "OCR Setup"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:44
|
||||
#: __init__.py:32 __init__.py:33
|
||||
msgid "submit to OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:45 __init__.py:46
|
||||
#: __init__.py:34 __init__.py:35
|
||||
msgid "re-queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:47 __init__.py:48 __init__.py:63
|
||||
#: __init__.py:36 __init__.py:37 __init__.py:50
|
||||
msgid "delete"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:50
|
||||
#: __init__.py:39
|
||||
msgid "stop queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:51
|
||||
#: __init__.py:40
|
||||
msgid "activate queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:53
|
||||
#: __init__.py:42
|
||||
msgid "clean up pages content"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:53
|
||||
#: __init__.py:42
|
||||
msgid ""
|
||||
"Runs a language filter to remove common OCR mistakes from document pages "
|
||||
"content."
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:55
|
||||
#: __init__.py:44
|
||||
msgid "queue document list"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:58 views.py:316
|
||||
msgid "active tasks"
|
||||
#: __init__.py:45 __init__.py:63 permissions.py:7
|
||||
msgid "OCR"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:60
|
||||
#: __init__.py:47
|
||||
msgid "transformations"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:61
|
||||
#: __init__.py:48
|
||||
msgid "add transformation"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:62
|
||||
#: __init__.py:49
|
||||
msgid "edit"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:82
|
||||
#: __init__.py:74
|
||||
msgid "Default"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:104
|
||||
#: __init__.py:102
|
||||
msgid "Checks the OCR queue for pending documents."
|
||||
msgstr ""
|
||||
|
||||
#: api.py:119
|
||||
#: api.py:122
|
||||
msgid "Text from OCR"
|
||||
msgstr ""
|
||||
|
||||
@@ -127,88 +99,108 @@ msgstr ""
|
||||
msgid "error"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:22
|
||||
#: models.py:26
|
||||
msgid "name"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:23
|
||||
#: models.py:27
|
||||
msgid "label"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:27 models.py:47
|
||||
#: models.py:31 models.py:51
|
||||
msgid "state"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:32 models.py:40 views.py:44 views.py:337 views.py:378
|
||||
#: views.py:408 views.py:444
|
||||
#: models.py:36 models.py:44 views.py:45 views.py:315 views.py:356
|
||||
#: views.py:386 views.py:422
|
||||
msgid "document queue"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:33
|
||||
#: models.py:37
|
||||
msgid "document queues"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:41
|
||||
#: models.py:45
|
||||
msgid "document"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:42
|
||||
#: models.py:46
|
||||
msgid "date time submitted"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:43
|
||||
#: models.py:47
|
||||
msgid "delay ocr"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:48
|
||||
#: models.py:52
|
||||
msgid "result"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:49
|
||||
#: models.py:53
|
||||
msgid "node name"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:53
|
||||
#: models.py:57
|
||||
msgid "queue document"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:54
|
||||
#: models.py:58
|
||||
msgid "queue documents"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:63 views.py:48
|
||||
#: models.py:78 views.py:49
|
||||
msgid "Missing document."
|
||||
msgstr ""
|
||||
|
||||
#: models.py:67
|
||||
#: models.py:82
|
||||
msgid "Enter a valid value."
|
||||
msgstr ""
|
||||
|
||||
#: models.py:95 views.py:341
|
||||
#: models.py:110 views.py:319
|
||||
msgid "order"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:96 views.py:342 views.py:379 views.py:409
|
||||
#: models.py:111 views.py:320 views.py:357 views.py:387
|
||||
msgid "transformation"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:97 views.py:343
|
||||
#: models.py:112 views.py:321
|
||||
msgid "arguments"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:97
|
||||
#: models.py:112
|
||||
#, python-format
|
||||
msgid "Use dictionaries to indentify arguments, example: %s"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:107
|
||||
#: models.py:122
|
||||
msgid "document queue transformation"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:108
|
||||
#: models.py:123
|
||||
msgid "document queue transformations"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:8
|
||||
msgid "Submit documents for OCR"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:9
|
||||
msgid "Delete documents from OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:10
|
||||
msgid "Can enable/disable the OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:11
|
||||
msgid "Can execute the OCR clean up on all document pages"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:12
|
||||
msgid "Can edit an OCR queue properties"
|
||||
msgstr ""
|
||||
|
||||
#: statistics.py:8
|
||||
#, python-format
|
||||
msgid "Document queues: %d"
|
||||
@@ -223,195 +215,179 @@ msgstr ""
|
||||
msgid "OCR statistics"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:41
|
||||
#: views.py:42
|
||||
#, python-format
|
||||
msgid "documents in queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:49
|
||||
#: views.py:50
|
||||
msgid "thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:62
|
||||
#: views.py:63
|
||||
msgid "document queue properties"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:63
|
||||
#: views.py:64
|
||||
#, python-format
|
||||
msgid "Current state: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:79 views.py:154
|
||||
#: views.py:80 views.py:168
|
||||
msgid "Must provide at least one queue document."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:89
|
||||
#: views.py:90
|
||||
#, python-format
|
||||
msgid "Document: %s is being processed and can't be deleted."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:92
|
||||
#: views.py:93
|
||||
#, python-format
|
||||
msgid "Queue document: %(document)s deleted successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:96
|
||||
#: views.py:97
|
||||
#, python-format
|
||||
msgid "Error deleting document: %(document)s; %(error)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:109
|
||||
#: views.py:110
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue document: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:111
|
||||
#: views.py:112
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue documents: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:134
|
||||
#: views.py:148
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was added to the OCR queue: %(queue)s."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:137
|
||||
#: views.py:151
|
||||
#, python-format
|
||||
msgid "Document: %(document)s is already queued."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:165
|
||||
#, python-format
|
||||
msgid "Document: %s is already being processed and can't be re-queded."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:173
|
||||
#: views.py:180
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was re-queued to the OCR queue: %(queue)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:176
|
||||
#: views.py:186
|
||||
#, python-format
|
||||
msgid "Document id#: %d, no longer exists."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:189
|
||||
#: views.py:190
|
||||
#, python-format
|
||||
msgid "Document: %s is already being processed and can't be re-queded."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:202
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue document: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:191
|
||||
#: views.py:204
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue documents: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:209
|
||||
#: views.py:222
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already stopped."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:215
|
||||
#: views.py:228
|
||||
#, python-format
|
||||
msgid "Document queue: %s, stopped successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:221
|
||||
#: views.py:234
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to disable document queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:236
|
||||
#: views.py:249
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already active."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:242
|
||||
#: views.py:255
|
||||
#, python-format
|
||||
msgid "Document queue: %s, activated successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:248
|
||||
#: views.py:261
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to activate document queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:265
|
||||
#: views.py:278
|
||||
msgid "Are you sure you wish to clean up all the pages content?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:266
|
||||
#: views.py:279
|
||||
msgid "On large databases this operation may take some time to execute."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:272
|
||||
#: views.py:285
|
||||
msgid "Document pages content clean up complete."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:274
|
||||
#: views.py:287
|
||||
#, python-format
|
||||
msgid "Document pages content clean up error: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:320
|
||||
msgid "node"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:321
|
||||
msgid "task id"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:322
|
||||
msgid "task name"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:323
|
||||
msgid "related object"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:335
|
||||
#: views.py:313
|
||||
#, python-format
|
||||
msgid "transformations for: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:365
|
||||
#: views.py:343
|
||||
msgid "Queue transformation edited successfully"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:368
|
||||
#: views.py:346
|
||||
#, python-format
|
||||
msgid "Error editing queue transformation; %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:373
|
||||
#: views.py:351
|
||||
#, python-format
|
||||
msgid "Edit transformation: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:396
|
||||
#: views.py:374
|
||||
msgid "Queue transformation deleted successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:398
|
||||
#: views.py:376
|
||||
#, python-format
|
||||
msgid "Error deleting queue transformation; %(error)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:411
|
||||
#: views.py:389
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Are you sure you wish to delete queue transformation \"%(transformation)s\""
|
||||
msgstr ""
|
||||
|
||||
#: views.py:434
|
||||
#: views.py:412
|
||||
msgid "Queue transformation created successfully"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:437
|
||||
#: views.py:415
|
||||
#, python-format
|
||||
msgid "Error creating queue transformation; %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:446
|
||||
#: views.py:424
|
||||
#, python-format
|
||||
msgid "Create new transformation for queue: %s"
|
||||
msgstr ""
|
||||
@@ -431,15 +407,9 @@ msgid "Automatically queue newly created documents for OCR."
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:17
|
||||
msgid ""
|
||||
"URI in the form: \"memcached://127.0.0.1:11211/\" to specify a cache backend "
|
||||
"to use for locking. Multiple hosts can be specified separated by a semicolon."
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:18
|
||||
msgid "File path to unpaper program."
|
||||
msgstr ""
|
||||
|
||||
#: parsers/__init__.py:23
|
||||
#: parsers/__init__.py:37
|
||||
msgid "Text extracted from PDF"
|
||||
msgstr ""
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
apps/ocr/locale/it/LC_MESSAGES/django.mo
Normal file
BIN
apps/ocr/locale/it/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
426
apps/ocr/locale/it/LC_MESSAGES/django.po
Normal file
426
apps/ocr/locale/it/LC_MESSAGES/django.po
Normal file
@@ -0,0 +1,426 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
#
|
||||
# Translators:
|
||||
# <pierpaolo.baldan@gmail.com>, 2011.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Mayan EDMS\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-02-12 15:20-0400\n"
|
||||
"PO-Revision-Date: 2012-02-02 18:19+0000\n"
|
||||
"Last-Translator: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>\n"
|
||||
"Language-Team: Italian (http://www.transifex.net/projects/p/mayan-edms/team/"
|
||||
"it/)\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
|
||||
#: __init__.py:32 __init__.py:33
|
||||
msgid "submit to OCR queue"
|
||||
msgstr "Sottoponi una coda di OCR"
|
||||
|
||||
#: __init__.py:34 __init__.py:35
|
||||
msgid "re-queue"
|
||||
msgstr "riaccoda"
|
||||
|
||||
#: __init__.py:36 __init__.py:37 __init__.py:50
|
||||
msgid "delete"
|
||||
msgstr "cancella"
|
||||
|
||||
#: __init__.py:39
|
||||
msgid "stop queue"
|
||||
msgstr "stoppa la coda"
|
||||
|
||||
#: __init__.py:40
|
||||
msgid "activate queue"
|
||||
msgstr "attiva la coda"
|
||||
|
||||
#: __init__.py:42
|
||||
msgid "clean up pages content"
|
||||
msgstr "ripulisci il contenuto delle pagine"
|
||||
|
||||
#: __init__.py:42
|
||||
msgid ""
|
||||
"Runs a language filter to remove common OCR mistakes from document pages "
|
||||
"content."
|
||||
msgstr ""
|
||||
"Esegue un filtro per rimuovere i comuni errori di OCR dal contenuto del "
|
||||
"documento pagine."
|
||||
|
||||
#: __init__.py:44
|
||||
msgid "queue document list"
|
||||
msgstr "lista dei documenti in coda"
|
||||
|
||||
#: __init__.py:45 __init__.py:63 permissions.py:7
|
||||
msgid "OCR"
|
||||
msgstr "OCR"
|
||||
|
||||
#: __init__.py:47
|
||||
msgid "transformations"
|
||||
msgstr "transformazioni"
|
||||
|
||||
#: __init__.py:48
|
||||
msgid "add transformation"
|
||||
msgstr "aggiungi trasformazione"
|
||||
|
||||
#: __init__.py:49
|
||||
msgid "edit"
|
||||
msgstr "modifica"
|
||||
|
||||
#: __init__.py:74
|
||||
msgid "Default"
|
||||
msgstr "Default"
|
||||
|
||||
#: __init__.py:102
|
||||
msgid "Checks the OCR queue for pending documents."
|
||||
msgstr "Controlla i documenti nella coda dell'OCR"
|
||||
|
||||
#: api.py:122
|
||||
msgid "Text from OCR"
|
||||
msgstr "testo dall'OCR"
|
||||
|
||||
#: literals.py:8
|
||||
msgid "stopped"
|
||||
msgstr "fermato"
|
||||
|
||||
#: literals.py:9
|
||||
msgid "active"
|
||||
msgstr "attivo"
|
||||
|
||||
#: literals.py:18
|
||||
msgid "pending"
|
||||
msgstr "in esecuzione"
|
||||
|
||||
#: literals.py:19
|
||||
msgid "processing"
|
||||
msgstr "in elaborazione"
|
||||
|
||||
#: literals.py:20
|
||||
msgid "error"
|
||||
msgstr "errore"
|
||||
|
||||
#: models.py:26
|
||||
msgid "name"
|
||||
msgstr "nome"
|
||||
|
||||
#: models.py:27
|
||||
msgid "label"
|
||||
msgstr "etichetta"
|
||||
|
||||
#: models.py:31 models.py:51
|
||||
msgid "state"
|
||||
msgstr "stato"
|
||||
|
||||
#: models.py:36 models.py:44 views.py:45 views.py:315 views.py:356
|
||||
#: views.py:386 views.py:422
|
||||
msgid "document queue"
|
||||
msgstr "coda del documento"
|
||||
|
||||
#: models.py:37
|
||||
msgid "document queues"
|
||||
msgstr "code di documenti"
|
||||
|
||||
#: models.py:45
|
||||
msgid "document"
|
||||
msgstr "documento"
|
||||
|
||||
#: models.py:46
|
||||
msgid "date time submitted"
|
||||
msgstr "orario di esecuzione"
|
||||
|
||||
#: models.py:47
|
||||
msgid "delay ocr"
|
||||
msgstr "proroga ocr"
|
||||
|
||||
#: models.py:52
|
||||
msgid "result"
|
||||
msgstr "risultato"
|
||||
|
||||
#: models.py:53
|
||||
msgid "node name"
|
||||
msgstr "nome del nodo"
|
||||
|
||||
#: models.py:57
|
||||
msgid "queue document"
|
||||
msgstr "coda del documento"
|
||||
|
||||
#: models.py:58
|
||||
msgid "queue documents"
|
||||
msgstr "code dei documenti"
|
||||
|
||||
#: models.py:78 views.py:49
|
||||
msgid "Missing document."
|
||||
msgstr "Documento perso"
|
||||
|
||||
#: models.py:82
|
||||
msgid "Enter a valid value."
|
||||
msgstr "Inserisci un valore valido"
|
||||
|
||||
#: models.py:110 views.py:319
|
||||
msgid "order"
|
||||
msgstr "ordina"
|
||||
|
||||
#: models.py:111 views.py:320 views.py:357 views.py:387
|
||||
msgid "transformation"
|
||||
msgstr "trasforma"
|
||||
|
||||
#: models.py:112 views.py:321
|
||||
msgid "arguments"
|
||||
msgstr "argomenti"
|
||||
|
||||
#: models.py:112
|
||||
#, python-format
|
||||
msgid "Use dictionaries to indentify arguments, example: %s"
|
||||
msgstr "Usa un dizionario per identificare gli argomenti, esempio: %s"
|
||||
|
||||
#: models.py:122
|
||||
msgid "document queue transformation"
|
||||
msgstr "coda del documento in trasformazione"
|
||||
|
||||
#: models.py:123
|
||||
msgid "document queue transformations"
|
||||
msgstr "code dei documenti in trasformazione"
|
||||
|
||||
#: permissions.py:8
|
||||
msgid "Submit documents for OCR"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:9
|
||||
msgid "Delete documents from OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:10
|
||||
msgid "Can enable/disable the OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:11
|
||||
msgid "Can execute the OCR clean up on all document pages"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:12
|
||||
msgid "Can edit an OCR queue properties"
|
||||
msgstr "Posso modificare le proprità della coda di OCR"
|
||||
|
||||
#: statistics.py:8
|
||||
#, python-format
|
||||
msgid "Document queues: %d"
|
||||
msgstr "Coda documento:%d"
|
||||
|
||||
#: statistics.py:9
|
||||
#, python-format
|
||||
msgid "Queued documents: %d"
|
||||
msgstr "Code di documenti:%d"
|
||||
|
||||
#: statistics.py:13
|
||||
msgid "OCR statistics"
|
||||
msgstr "Statistiche OCR"
|
||||
|
||||
#: views.py:42
|
||||
#, python-format
|
||||
msgid "documents in queue: %s"
|
||||
msgstr "documenti in coda: %s"
|
||||
|
||||
#: views.py:50
|
||||
msgid "thumbnail"
|
||||
msgstr "thumbnail"
|
||||
|
||||
#: views.py:63
|
||||
msgid "document queue properties"
|
||||
msgstr "proprietà della coda documenti"
|
||||
|
||||
#: views.py:64
|
||||
#, python-format
|
||||
msgid "Current state: %s"
|
||||
msgstr "Stato corrente: %s"
|
||||
|
||||
#: views.py:80 views.py:168
|
||||
msgid "Must provide at least one queue document."
|
||||
msgstr "Deve fornire almeno un documento di coda."
|
||||
|
||||
#: views.py:90
|
||||
#, python-format
|
||||
msgid "Document: %s is being processed and can't be deleted."
|
||||
msgstr "Il document: %s è in elaborazione e non può essere cancellato."
|
||||
|
||||
#: views.py:93
|
||||
#, python-format
|
||||
msgid "Queue document: %(document)s deleted successfully."
|
||||
msgstr "Coda documento: %(document)s cancellata con successo."
|
||||
|
||||
#: views.py:97
|
||||
#, python-format
|
||||
msgid "Error deleting document: %(document)s; %(error)s"
|
||||
msgstr "Errore nella cancellazione del documento: %(document)s; %(error)s"
|
||||
|
||||
#: views.py:110
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue document: %s?"
|
||||
msgstr "Sei sicuro di voler cancellare questa coda documento: %s?"
|
||||
|
||||
#: views.py:112
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue documents: %s?"
|
||||
msgstr "Sei sicuro di voler cancellare queste code documento: %s?"
|
||||
|
||||
#: views.py:148
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was added to the OCR queue: %(queue)s."
|
||||
msgstr ""
|
||||
"Il documento: %(document)s è stato aggiunto alla coda %(queue)s per OCR."
|
||||
|
||||
#: views.py:151
|
||||
#, python-format
|
||||
msgid "Document: %(document)s is already queued."
|
||||
msgstr "Il documento: %(document)s è gia stato elaborato."
|
||||
|
||||
#: views.py:180
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was re-queued to the OCR queue: %(queue)s"
|
||||
msgstr "Il documento: %(document)s è stato riprocessato %(queue)s per OCR."
|
||||
|
||||
#: views.py:186
|
||||
#, python-format
|
||||
msgid "Document id#: %d, no longer exists."
|
||||
msgstr "il documento id#: %d,non esiste più."
|
||||
|
||||
#: views.py:190
|
||||
#, python-format
|
||||
msgid "Document: %s is already being processed and can't be re-queded."
|
||||
msgstr "Il documento: %s è gia stato processato non può essere riprocessato."
|
||||
|
||||
#: views.py:202
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue document: %s?"
|
||||
msgstr "Sei sicuro di volere riprocessare il documento: %s?"
|
||||
|
||||
#: views.py:204
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue documents: %s?"
|
||||
msgstr "Sei sicuro di volere riprocessare questi documenti: %s?"
|
||||
|
||||
#: views.py:222
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already stopped."
|
||||
msgstr "Questa coda: %s, è stata appena fermata."
|
||||
|
||||
#: views.py:228
|
||||
#, python-format
|
||||
msgid "Document queue: %s, stopped successfully."
|
||||
msgstr "Questa coda: %s,è stata fermata con successo."
|
||||
|
||||
#: views.py:234
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to disable document queue: %s"
|
||||
msgstr "Sei sicuro di voler fermare la coda per il documento: %s"
|
||||
|
||||
#: views.py:249
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already active."
|
||||
msgstr "La coda per questo documento: %s, è già attiva."
|
||||
|
||||
#: views.py:255
|
||||
#, python-format
|
||||
msgid "Document queue: %s, activated successfully."
|
||||
msgstr "Coda documento: %s, attivata con successo."
|
||||
|
||||
#: views.py:261
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to activate document queue: %s"
|
||||
msgstr "Sei sicuro di voler attivare questa coda documento: %s"
|
||||
|
||||
#: views.py:278
|
||||
msgid "Are you sure you wish to clean up all the pages content?"
|
||||
msgstr "Sei sicuro di voler ripulire tutto il contenuto delle pagine?"
|
||||
|
||||
#: views.py:279
|
||||
msgid "On large databases this operation may take some time to execute."
|
||||
msgstr "Nei database grandi questa operazione può richiedere del tempo."
|
||||
|
||||
#: views.py:285
|
||||
msgid "Document pages content clean up complete."
|
||||
msgstr "Pulizia del contenuto delle pagine completata."
|
||||
|
||||
#: views.py:287
|
||||
#, python-format
|
||||
msgid "Document pages content clean up error: %s"
|
||||
msgstr "Errore nella pulizia del contenuto delle pagine: %s"
|
||||
|
||||
#: views.py:313
|
||||
#, python-format
|
||||
msgid "transformations for: %s"
|
||||
msgstr "trasformazione per: %s"
|
||||
|
||||
#: views.py:343
|
||||
msgid "Queue transformation edited successfully"
|
||||
msgstr "Modifica della coda di trasformazione effettuata con successo"
|
||||
|
||||
#: views.py:346
|
||||
#, python-format
|
||||
msgid "Error editing queue transformation; %s"
|
||||
msgstr "Errore nella modifica alla coda di trasformazione; %s"
|
||||
|
||||
#: views.py:351
|
||||
#, python-format
|
||||
msgid "Edit transformation: %s"
|
||||
msgstr "Modifica trasformazioni:%s"
|
||||
|
||||
#: views.py:374
|
||||
msgid "Queue transformation deleted successfully."
|
||||
msgstr "Coda di trasformazione cancellata con successo"
|
||||
|
||||
#: views.py:376
|
||||
#, python-format
|
||||
msgid "Error deleting queue transformation; %(error)s"
|
||||
msgstr "Errore nella cancellazione della coda di trasformazione; %(error)s"
|
||||
|
||||
#: views.py:389
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Are you sure you wish to delete queue transformation \"%(transformation)s\""
|
||||
msgstr ""
|
||||
"Sei sicuro di voler cancellare la coda di trasformazione \"%(transformation)s"
|
||||
"\""
|
||||
|
||||
#: views.py:412
|
||||
msgid "Queue transformation created successfully"
|
||||
msgstr "Coda di trasformazione creata con successo"
|
||||
|
||||
#: views.py:415
|
||||
#, python-format
|
||||
msgid "Error creating queue transformation; %s"
|
||||
msgstr "Errore creano la coda di trasformazione; %s"
|
||||
|
||||
#: views.py:424
|
||||
#, python-format
|
||||
msgid "Create new transformation for queue: %s"
|
||||
msgstr "Crea una nuova coda di trasformazione:%s"
|
||||
|
||||
#: conf/settings.py:13
|
||||
msgid ""
|
||||
"Amount of seconds to delay OCR of documents to allow for the node's storage "
|
||||
"replication overhead."
|
||||
msgstr ""
|
||||
"Quantità di secondi di ritardo OCR di documenti per consentire lo stoccaggio "
|
||||
"nel nodo di replica."
|
||||
|
||||
#: conf/settings.py:14
|
||||
msgid "Maximum amount of concurrent document OCRs a node can perform."
|
||||
msgstr ""
|
||||
"Importo massimo di documenti concorrenti per OCR che un nodo è in grado di "
|
||||
"eseguire."
|
||||
|
||||
#: conf/settings.py:15
|
||||
msgid "Automatically queue newly created documents for OCR."
|
||||
msgstr "Automaticamente crea una coda appena si sottomone un documento ad OCR."
|
||||
|
||||
#: conf/settings.py:17
|
||||
msgid "File path to unpaper program."
|
||||
msgstr "File path per il programma unpaper"
|
||||
|
||||
#: parsers/__init__.py:37
|
||||
msgid "Text extracted from PDF"
|
||||
msgstr "Testo estratto da PDF"
|
||||
BIN
apps/ocr/locale/pl/LC_MESSAGES/django.mo
Normal file
BIN
apps/ocr/locale/pl/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
415
apps/ocr/locale/pl/LC_MESSAGES/django.po
Normal file
415
apps/ocr/locale/pl/LC_MESSAGES/django.po
Normal file
@@ -0,0 +1,415 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
#
|
||||
# Translators:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Mayan EDMS\n"
|
||||
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
|
||||
"POT-Creation-Date: 2012-02-12 15:20-0400\n"
|
||||
"PO-Revision-Date: 2011-09-30 04:41+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Polish (http://www.transifex.net/projects/p/mayan-edms/language/pl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: pl\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
|
||||
|
||||
#: __init__.py:32 __init__.py:33
|
||||
msgid "submit to OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:34 __init__.py:35
|
||||
msgid "re-queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:36 __init__.py:37 __init__.py:50
|
||||
msgid "delete"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:39
|
||||
msgid "stop queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:40
|
||||
msgid "activate queue"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:42
|
||||
msgid "clean up pages content"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:42
|
||||
msgid ""
|
||||
"Runs a language filter to remove common OCR mistakes from document pages "
|
||||
"content."
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:44
|
||||
msgid "queue document list"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:45 __init__.py:63 permissions.py:7
|
||||
msgid "OCR"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:47
|
||||
msgid "transformations"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:48
|
||||
msgid "add transformation"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:49
|
||||
msgid "edit"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:74
|
||||
msgid "Default"
|
||||
msgstr ""
|
||||
|
||||
#: __init__.py:102
|
||||
msgid "Checks the OCR queue for pending documents."
|
||||
msgstr ""
|
||||
|
||||
#: api.py:122
|
||||
msgid "Text from OCR"
|
||||
msgstr ""
|
||||
|
||||
#: literals.py:8
|
||||
msgid "stopped"
|
||||
msgstr ""
|
||||
|
||||
#: literals.py:9
|
||||
msgid "active"
|
||||
msgstr ""
|
||||
|
||||
#: literals.py:18
|
||||
msgid "pending"
|
||||
msgstr ""
|
||||
|
||||
#: literals.py:19
|
||||
msgid "processing"
|
||||
msgstr ""
|
||||
|
||||
#: literals.py:20
|
||||
msgid "error"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:26
|
||||
msgid "name"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:27
|
||||
msgid "label"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:31 models.py:51
|
||||
msgid "state"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:36 models.py:44 views.py:45 views.py:315 views.py:356
|
||||
#: views.py:386 views.py:422
|
||||
msgid "document queue"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:37
|
||||
msgid "document queues"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:45
|
||||
msgid "document"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:46
|
||||
msgid "date time submitted"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:47
|
||||
msgid "delay ocr"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:52
|
||||
msgid "result"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:53
|
||||
msgid "node name"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:57
|
||||
msgid "queue document"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:58
|
||||
msgid "queue documents"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:78 views.py:49
|
||||
msgid "Missing document."
|
||||
msgstr ""
|
||||
|
||||
#: models.py:82
|
||||
msgid "Enter a valid value."
|
||||
msgstr ""
|
||||
|
||||
#: models.py:110 views.py:319
|
||||
msgid "order"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:111 views.py:320 views.py:357 views.py:387
|
||||
msgid "transformation"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:112 views.py:321
|
||||
msgid "arguments"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:112
|
||||
#, python-format
|
||||
msgid "Use dictionaries to indentify arguments, example: %s"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:122
|
||||
msgid "document queue transformation"
|
||||
msgstr ""
|
||||
|
||||
#: models.py:123
|
||||
msgid "document queue transformations"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:8
|
||||
msgid "Submit documents for OCR"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:9
|
||||
msgid "Delete documents from OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:10
|
||||
msgid "Can enable/disable the OCR queue"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:11
|
||||
msgid "Can execute the OCR clean up on all document pages"
|
||||
msgstr ""
|
||||
|
||||
#: permissions.py:12
|
||||
msgid "Can edit an OCR queue properties"
|
||||
msgstr ""
|
||||
|
||||
#: statistics.py:8
|
||||
#, python-format
|
||||
msgid "Document queues: %d"
|
||||
msgstr ""
|
||||
|
||||
#: statistics.py:9
|
||||
#, python-format
|
||||
msgid "Queued documents: %d"
|
||||
msgstr ""
|
||||
|
||||
#: statistics.py:13
|
||||
msgid "OCR statistics"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:42
|
||||
#, python-format
|
||||
msgid "documents in queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:50
|
||||
msgid "thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:63
|
||||
msgid "document queue properties"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:64
|
||||
#, python-format
|
||||
msgid "Current state: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:80 views.py:168
|
||||
msgid "Must provide at least one queue document."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:90
|
||||
#, python-format
|
||||
msgid "Document: %s is being processed and can't be deleted."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:93
|
||||
#, python-format
|
||||
msgid "Queue document: %(document)s deleted successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:97
|
||||
#, python-format
|
||||
msgid "Error deleting document: %(document)s; %(error)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:110
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue document: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:112
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to delete queue documents: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:148
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was added to the OCR queue: %(queue)s."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:151
|
||||
#, python-format
|
||||
msgid "Document: %(document)s is already queued."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:180
|
||||
#, python-format
|
||||
msgid "Document: %(document)s was re-queued to the OCR queue: %(queue)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:186
|
||||
#, python-format
|
||||
msgid "Document id#: %d, no longer exists."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:190
|
||||
#, python-format
|
||||
msgid "Document: %s is already being processed and can't be re-queded."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:202
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue document: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:204
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to re-queue documents: %s?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:222
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already stopped."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:228
|
||||
#, python-format
|
||||
msgid "Document queue: %s, stopped successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:234
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to disable document queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:249
|
||||
#, python-format
|
||||
msgid "Document queue: %s, already active."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:255
|
||||
#, python-format
|
||||
msgid "Document queue: %s, activated successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:261
|
||||
#, python-format
|
||||
msgid "Are you sure you wish to activate document queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:278
|
||||
msgid "Are you sure you wish to clean up all the pages content?"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:279
|
||||
msgid "On large databases this operation may take some time to execute."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:285
|
||||
msgid "Document pages content clean up complete."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:287
|
||||
#, python-format
|
||||
msgid "Document pages content clean up error: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:313
|
||||
#, python-format
|
||||
msgid "transformations for: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:343
|
||||
msgid "Queue transformation edited successfully"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:346
|
||||
#, python-format
|
||||
msgid "Error editing queue transformation; %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:351
|
||||
#, python-format
|
||||
msgid "Edit transformation: %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:374
|
||||
msgid "Queue transformation deleted successfully."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:376
|
||||
#, python-format
|
||||
msgid "Error deleting queue transformation; %(error)s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:389
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Are you sure you wish to delete queue transformation \"%(transformation)s\""
|
||||
msgstr ""
|
||||
|
||||
#: views.py:412
|
||||
msgid "Queue transformation created successfully"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:415
|
||||
#, python-format
|
||||
msgid "Error creating queue transformation; %s"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:424
|
||||
#, python-format
|
||||
msgid "Create new transformation for queue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:13
|
||||
msgid ""
|
||||
"Amount of seconds to delay OCR of documents to allow for the node's storage "
|
||||
"replication overhead."
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:14
|
||||
msgid "Maximum amount of concurrent document OCRs a node can perform."
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:15
|
||||
msgid "Automatically queue newly created documents for OCR."
|
||||
msgstr ""
|
||||
|
||||
#: conf/settings.py:17
|
||||
msgid "File path to unpaper program."
|
||||
msgstr ""
|
||||
|
||||
#: parsers/__init__.py:37
|
||||
msgid "Text extracted from PDF"
|
||||
msgstr ""
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,15 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.db import models
|
||||
|
||||
from ocr.exceptions import AlreadyQueued
|
||||
from .exceptions import AlreadyQueued
|
||||
|
||||
|
||||
class DocumentQueueManager(models.Manager):
|
||||
"""
|
||||
'''
|
||||
Module manager class to handle adding documents to an OCR document
|
||||
queue
|
||||
"""
|
||||
'''
|
||||
def queue_document(self, document, queue_name='default'):
|
||||
document_queue = self.model.objects.get(name=queue_name)
|
||||
if document_queue.queuedocument_set.filter(document=document):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from ast import literal_eval
|
||||
from datetime import datetime
|
||||
|
||||
@@ -13,11 +15,11 @@ from documents.models import Document
|
||||
from converter.api import get_available_transformations_choices
|
||||
from sources.managers import SourceTransformationManager
|
||||
|
||||
from ocr.literals import DOCUMENTQUEUE_STATE_STOPPED, \
|
||||
DOCUMENTQUEUE_STATE_CHOICES, QUEUEDOCUMENT_STATE_PENDING, \
|
||||
QUEUEDOCUMENT_STATE_CHOICES, QUEUEDOCUMENT_STATE_PROCESSING
|
||||
from ocr.managers import DocumentQueueManager
|
||||
from ocr.exceptions import ReQueueError
|
||||
from .literals import (DOCUMENTQUEUE_STATE_STOPPED,
|
||||
DOCUMENTQUEUE_STATE_CHOICES, QUEUEDOCUMENT_STATE_PENDING,
|
||||
QUEUEDOCUMENT_STATE_CHOICES, QUEUEDOCUMENT_STATE_PROCESSING)
|
||||
from .managers import DocumentQueueManager
|
||||
from .exceptions import ReQueueError
|
||||
|
||||
|
||||
class DocumentQueue(models.Model):
|
||||
@@ -87,9 +89,9 @@ class ArgumentsValidator(object):
|
||||
self.code = code
|
||||
|
||||
def __call__(self, value):
|
||||
"""
|
||||
'''
|
||||
Validates that the input evaluates correctly.
|
||||
"""
|
||||
'''
|
||||
value = value.strip()
|
||||
try:
|
||||
literal_eval(value)
|
||||
@@ -98,10 +100,10 @@ class ArgumentsValidator(object):
|
||||
|
||||
|
||||
class QueueTransformation(models.Model):
|
||||
"""
|
||||
'''
|
||||
Model that stores the transformation and transformation arguments
|
||||
for a given document queue
|
||||
"""
|
||||
'''
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
@@ -3,10 +3,9 @@ import logging
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from converter import office_converter
|
||||
from converter import office_converter
|
||||
from converter.office_converter import OfficeConverter
|
||||
from converter.exceptions import OfficeBackendError, OfficeConversionError
|
||||
from converter.exceptions import OfficeConversionError
|
||||
from documents.utils import document_save_to_temp_dir
|
||||
|
||||
from ocr.parsers.exceptions import ParserError, ParserUnknownFile
|
||||
@@ -27,7 +26,7 @@ def register_parser(function, mimetype=None, mimetypes=None):
|
||||
def pdf_parser(document_page, descriptor=None):
|
||||
if not descriptor:
|
||||
descriptor = document_page.document_version.open()
|
||||
|
||||
|
||||
pdf_pages = slate.PDF(descriptor)
|
||||
descriptor.close()
|
||||
|
||||
@@ -45,7 +44,7 @@ def office_parser(document_page):
|
||||
office_converter = OfficeConverter()
|
||||
document_file = document_save_to_temp_dir(document_page.document, document_page.document.checksum)
|
||||
logger.debug('document_file: %s', document_file)
|
||||
|
||||
|
||||
office_converter.convert(document_file, mimetype=document_page.document.file_mimetype)
|
||||
if office_converter.exists:
|
||||
input_filepath = office_converter.output_filepath
|
||||
@@ -58,7 +57,7 @@ def office_parser(document_page):
|
||||
except OfficeConversionError, msg:
|
||||
print msg
|
||||
raise ParserError
|
||||
|
||||
|
||||
|
||||
def parse_document_page(document_page):
|
||||
logger.debug('executing')
|
||||
|
||||
12
apps/ocr/permissions.py
Normal file
12
apps/ocr/permissions.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from permissions.models import Permission, PermissionNamespace
|
||||
|
||||
ocr_namespace = PermissionNamespace('ocr', _(u'OCR'))
|
||||
PERMISSION_OCR_DOCUMENT = Permission.objects.register(ocr_namespace, 'ocr_document', _(u'Submit documents for OCR'))
|
||||
PERMISSION_OCR_DOCUMENT_DELETE = Permission.objects.register(ocr_namespace, 'ocr_document_delete', _(u'Delete documents from OCR queue'))
|
||||
PERMISSION_OCR_QUEUE_ENABLE_DISABLE = Permission.objects.register(ocr_namespace, 'ocr_queue_enable_disable', _(u'Can enable/disable the OCR queue'))
|
||||
PERMISSION_OCR_CLEAN_ALL_PAGES = Permission.objects.register(ocr_namespace, 'ocr_clean_all_pages', _(u'Can execute the OCR clean up on all document pages'))
|
||||
PERMISSION_OCR_QUEUE_EDIT = Permission.objects.register(ocr_namespace, 'ocr_queue_edit', _(u'Can edit an OCR queue properties'))
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from datetime import timedelta, datetime
|
||||
import platform
|
||||
from time import sleep
|
||||
from random import random
|
||||
import logging
|
||||
|
||||
from django.db.models import Q
|
||||
@@ -9,15 +9,13 @@ from django.db.models import Q
|
||||
from job_processor.api import process_job
|
||||
from lock_manager import Lock, LockError
|
||||
|
||||
from ocr.api import do_document_ocr
|
||||
from ocr.literals import QUEUEDOCUMENT_STATE_PENDING, \
|
||||
QUEUEDOCUMENT_STATE_PROCESSING, DOCUMENTQUEUE_STATE_ACTIVE, \
|
||||
QUEUEDOCUMENT_STATE_ERROR
|
||||
from ocr.models import QueueDocument, DocumentQueue
|
||||
from ocr.conf.settings import NODE_CONCURRENT_EXECUTION
|
||||
from ocr.conf.settings import REPLICATION_DELAY
|
||||
from ocr.conf.settings import CACHE_URI
|
||||
from ocr.conf.settings import QUEUE_PROCESSING_INTERVAL
|
||||
from .api import do_document_ocr
|
||||
from .literals import (QUEUEDOCUMENT_STATE_PENDING,
|
||||
QUEUEDOCUMENT_STATE_PROCESSING, DOCUMENTQUEUE_STATE_ACTIVE,
|
||||
QUEUEDOCUMENT_STATE_ERROR)
|
||||
from .models import QueueDocument, DocumentQueue
|
||||
from .conf.settings import (NODE_CONCURRENT_EXECUTION, REPLICATION_DELAY,
|
||||
QUEUE_PROCESSING_INTERVAL)
|
||||
|
||||
LOCK_EXPIRE = 60 * 10 # Lock expires in 10 minutes
|
||||
# TODO: Tie LOCK_EXPIRATION with hard task timeout
|
||||
@@ -42,44 +40,16 @@ def task_process_queue_document(queue_document_id):
|
||||
queue_document.state = QUEUEDOCUMENT_STATE_ERROR
|
||||
queue_document.result = e
|
||||
queue_document.save()
|
||||
|
||||
|
||||
lock.release()
|
||||
except LockError:
|
||||
logger.debug('unable to obtain lock')
|
||||
pass
|
||||
|
||||
|
||||
def reset_orphans():
|
||||
pass
|
||||
'''
|
||||
i = inspect().active()
|
||||
active_tasks = []
|
||||
orphans = []
|
||||
|
||||
if i:
|
||||
for host, instances in i.items():
|
||||
for instance in instances:
|
||||
active_tasks.append(instance['id'])
|
||||
|
||||
for document_queue in DocumentQueue.objects.filter(state=DOCUMENTQUEUE_STATE_ACTIVE):
|
||||
orphans = document_queue.queuedocument_set.\
|
||||
filter(state=QUEUEDOCUMENT_STATE_PROCESSING).\
|
||||
exclude(result__in=active_tasks)
|
||||
|
||||
for orphan in orphans:
|
||||
orphan.result = _(u'Orphaned')
|
||||
orphan.state = QUEUEDOCUMENT_STATE_PENDING
|
||||
orphan.delay = False
|
||||
orphan.node_name = None
|
||||
orphan.save()
|
||||
'''
|
||||
|
||||
|
||||
def task_process_document_queues():
|
||||
logger.debug('executed')
|
||||
# reset_orphans()
|
||||
# Causes problems with big clusters increased latency
|
||||
# Disabled until better solution
|
||||
# TODO: reset_orphans()
|
||||
q_pending = Q(state=QUEUEDOCUMENT_STATE_PENDING)
|
||||
q_delayed = Q(delay=True)
|
||||
q_delay_interval = Q(datetime_submitted__lt=datetime.now() - timedelta(seconds=REPLICATION_DELAY))
|
||||
@@ -100,7 +70,7 @@ def task_process_document_queues():
|
||||
#print 'DocumentQueueWatcher exception: %s' % e
|
||||
finally:
|
||||
# Don't process anymore from this queryset, might be stale
|
||||
break;
|
||||
break
|
||||
else:
|
||||
logger.debug('already processing maximun')
|
||||
else:
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.failUnlessEqual(1 + 1, 2)
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
@@ -13,7 +13,6 @@ urlpatterns = patterns('ocr.views',
|
||||
url(r'^queue/(?P<document_queue_id>\d+)/disable/$', 'document_queue_disable', (), 'document_queue_disable'),
|
||||
|
||||
url(r'^document/all/clean_up/$', 'all_document_ocr_cleanup', (), 'all_document_ocr_cleanup'),
|
||||
url(r'^node/active/list/$', 'node_active_list', (), 'node_active_list'),
|
||||
|
||||
url(r'^queue/(?P<document_queue_id>\d+)/transformation/list/$', 'setup_queue_transformation_list', (), 'setup_queue_transformation_list'),
|
||||
url(r'^queue/(?P<document_queue_id>\w+)/transformation/create/$', 'setup_queue_transformation_create', (), 'setup_queue_transformation_create'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import socket
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
@@ -7,28 +7,28 @@ from django.contrib import messages
|
||||
from django.views.generic.list_detail import object_list
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.exceptions import PermissionDenied
|
||||
|
||||
from celery.task.control import inspect
|
||||
from permissions.api import check_permissions
|
||||
from permissions.models import Permission
|
||||
from documents.models import Document
|
||||
from documents.widgets import document_link, document_thumbnail
|
||||
from common.utils import encapsulate
|
||||
from acls.models import AccessEntry
|
||||
|
||||
from ocr import PERMISSION_OCR_DOCUMENT, PERMISSION_OCR_DOCUMENT_DELETE, \
|
||||
PERMISSION_OCR_QUEUE_ENABLE_DISABLE, PERMISSION_OCR_CLEAN_ALL_PAGES, \
|
||||
PERMISSION_OCR_QUEUE_EDIT
|
||||
|
||||
from ocr.models import DocumentQueue, QueueDocument, QueueTransformation
|
||||
from ocr.literals import QUEUEDOCUMENT_STATE_PENDING, \
|
||||
QUEUEDOCUMENT_STATE_PROCESSING, DOCUMENTQUEUE_STATE_STOPPED, \
|
||||
DOCUMENTQUEUE_STATE_ACTIVE
|
||||
from ocr.exceptions import AlreadyQueued, ReQueueError
|
||||
from ocr.api import clean_pages
|
||||
from ocr.forms import QueueTransformationForm, QueueTransformationForm_create
|
||||
from .permissions import (PERMISSION_OCR_DOCUMENT,
|
||||
PERMISSION_OCR_DOCUMENT_DELETE, PERMISSION_OCR_QUEUE_ENABLE_DISABLE,
|
||||
PERMISSION_OCR_CLEAN_ALL_PAGES, PERMISSION_OCR_QUEUE_EDIT)
|
||||
from .models import DocumentQueue, QueueDocument, QueueTransformation
|
||||
from .literals import (QUEUEDOCUMENT_STATE_PENDING,
|
||||
QUEUEDOCUMENT_STATE_PROCESSING, DOCUMENTQUEUE_STATE_STOPPED,
|
||||
DOCUMENTQUEUE_STATE_ACTIVE)
|
||||
from .exceptions import AlreadyQueued, ReQueueError
|
||||
from .api import clean_pages
|
||||
from .forms import QueueTransformationForm, QueueTransformationForm_create
|
||||
|
||||
|
||||
def queue_document_list(request, queue_name='default'):
|
||||
check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
|
||||
document_queue = get_object_or_404(DocumentQueue, name=queue_name)
|
||||
|
||||
@@ -68,7 +68,7 @@ def queue_document_list(request, queue_name='default'):
|
||||
|
||||
|
||||
def queue_document_delete(request, queue_document_id=None, queue_document_id_list=None):
|
||||
check_permissions(request.user, [PERMISSION_OCR_DOCUMENT_DELETE])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_DOCUMENT_DELETE])
|
||||
|
||||
if queue_document_id:
|
||||
queue_documents = [get_object_or_404(QueueDocument, pk=queue_document_id)]
|
||||
@@ -120,20 +120,26 @@ def queue_document_multiple_delete(request):
|
||||
def submit_document_multiple(request):
|
||||
for item_id in request.GET.get('id_list', '').split(','):
|
||||
submit_document(request, item_id)
|
||||
|
||||
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||
|
||||
|
||||
|
||||
def submit_document(request, document_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
|
||||
document = get_object_or_404(Document, pk=document_id)
|
||||
|
||||
try:
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
except PermissionDenied:
|
||||
AccessEntry.objects.check_access(PERMISSION_OCR_DOCUMENT, request.user, document)
|
||||
|
||||
return submit_document_to_queue(request, document=document,
|
||||
post_submit_redirect=request.META.get('HTTP_REFERER', '/'))
|
||||
|
||||
|
||||
def submit_document_to_queue(request, document, post_submit_redirect=None):
|
||||
"""This view is meant to be reusable"""
|
||||
'''
|
||||
This view is meant to be reusable
|
||||
'''
|
||||
|
||||
try:
|
||||
document_queue = DocumentQueue.objects.queue_document(document)
|
||||
@@ -150,7 +156,7 @@ def submit_document_to_queue(request, document, post_submit_redirect=None):
|
||||
|
||||
|
||||
def re_queue_document(request, queue_document_id=None, queue_document_id_list=None):
|
||||
check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
|
||||
if queue_document_id:
|
||||
queue_documents = [get_object_or_404(QueueDocument, pk=queue_document_id)]
|
||||
@@ -204,7 +210,7 @@ def re_queue_multiple_document(request):
|
||||
|
||||
|
||||
def document_queue_disable(request, document_queue_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_ENABLE_DISABLE])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_ENABLE_DISABLE])
|
||||
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', None)))
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||
@@ -231,7 +237,7 @@ def document_queue_disable(request, document_queue_id):
|
||||
|
||||
|
||||
def document_queue_enable(request, document_queue_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_ENABLE_DISABLE])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_ENABLE_DISABLE])
|
||||
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', None)))
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||
@@ -258,7 +264,7 @@ def document_queue_enable(request, document_queue_id):
|
||||
|
||||
|
||||
def all_document_ocr_cleanup(request):
|
||||
check_permissions(request.user, [PERMISSION_OCR_CLEAN_ALL_PAGES])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_CLEAN_ALL_PAGES])
|
||||
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', None)))
|
||||
@@ -294,44 +300,9 @@ def display_link(obj):
|
||||
return obj
|
||||
|
||||
|
||||
def node_active_list(request):
|
||||
check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])
|
||||
|
||||
i = inspect()
|
||||
active_tasks = []
|
||||
try:
|
||||
active_nodes = i.active()
|
||||
if active_nodes:
|
||||
for node, tasks in active_nodes.items():
|
||||
for task in tasks:
|
||||
task_info = {
|
||||
'node': node,
|
||||
'task_name': task['name'],
|
||||
'task_id': task['id'],
|
||||
'related_object': None,
|
||||
}
|
||||
if task['name'] == u'ocr.tasks.task_process_queue_document':
|
||||
task_info['related_object'] = QueueDocument.objects.get(pk=eval(task['args'])[0]).document
|
||||
active_tasks.append(task_info)
|
||||
except socket.error:
|
||||
active_tasks = []
|
||||
|
||||
return render_to_response('generic_list.html', {
|
||||
'object_list': active_tasks,
|
||||
'title': _(u'active tasks'),
|
||||
'hide_links': True,
|
||||
'hide_object': True,
|
||||
'extra_columns': [
|
||||
{'name': _(u'node'), 'attribute': 'node'},
|
||||
{'name': _(u'task id'), 'attribute': 'task_id'},
|
||||
{'name': _(u'task name'), 'attribute': 'task_name'},
|
||||
{'name': _(u'related object'), 'attribute': lambda x: display_link(x['related_object']) if x['related_object'] else u''}
|
||||
],
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
# Setup views
|
||||
def setup_queue_transformation_list(request, document_queue_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
|
||||
document_queue = get_object_or_404(DocumentQueue, pk=document_queue_id)
|
||||
|
||||
@@ -356,7 +327,7 @@ def setup_queue_transformation_list(request, document_queue_id):
|
||||
|
||||
|
||||
def setup_queue_transformation_edit(request, transformation_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
|
||||
transformation = get_object_or_404(QueueTransformation, pk=transformation_id)
|
||||
redirect_view = reverse('setup_queue_transformation_list', args=[transformation.content_object.pk])
|
||||
@@ -389,7 +360,7 @@ def setup_queue_transformation_edit(request, transformation_id):
|
||||
|
||||
|
||||
def setup_queue_transformation_delete(request, transformation_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
|
||||
transformation = get_object_or_404(QueueTransformation, pk=transformation_id)
|
||||
redirect_view = reverse('setup_queue_transformation_list', args=[transformation.content_object.pk])
|
||||
@@ -423,7 +394,7 @@ def setup_queue_transformation_delete(request, transformation_id):
|
||||
|
||||
|
||||
def setup_queue_transformation_create(request, document_queue_id):
|
||||
check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_OCR_QUEUE_EDIT])
|
||||
|
||||
document_queue = get_object_or_404(DocumentQueue, pk=document_queue_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user