Codying style update, added comments
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user