diff --git a/apps/ocr/exceptions.py b/apps/ocr/exceptions.py index 704e0ae9c7..0b6f4a129a 100644 --- a/apps/ocr/exceptions.py +++ b/apps/ocr/exceptions.py @@ -1,15 +1,21 @@ class AlreadyQueued(Exception): + ''' + Raised when a trying to queue document already in the queue + ''' pass class TesseractError(Exception): + ''' + Raised by tesseract + ''' pass class UnpaperError(Exception): - """ + ''' Raised by unpaper - """ + ''' pass diff --git a/apps/ocr/managers.py b/apps/ocr/managers.py index 13c98ece27..b4596356d6 100644 --- a/apps/ocr/managers.py +++ b/apps/ocr/managers.py @@ -6,10 +6,10 @@ 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): diff --git a/apps/ocr/models.py b/apps/ocr/models.py index 4457c3683d..3717f0ffe9 100644 --- a/apps/ocr/models.py +++ b/apps/ocr/models.py @@ -89,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) @@ -100,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') diff --git a/apps/ocr/permissions.py b/apps/ocr/permissions.py index fefb6843ce..f74f1ec267 100644 --- a/apps/ocr/permissions.py +++ b/apps/ocr/permissions.py @@ -5,7 +5,6 @@ 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'))