Codying style update, added comments

This commit is contained in:
Roberto Rosario
2012-01-03 04:37:03 -04:00
parent 19b2412e03
commit b89c55ed18
4 changed files with 14 additions and 9 deletions

View File

@@ -1,15 +1,21 @@
class AlreadyQueued(Exception): class AlreadyQueued(Exception):
'''
Raised when a trying to queue document already in the queue
'''
pass pass
class TesseractError(Exception): class TesseractError(Exception):
'''
Raised by tesseract
'''
pass pass
class UnpaperError(Exception): class UnpaperError(Exception):
""" '''
Raised by unpaper Raised by unpaper
""" '''
pass pass

View File

@@ -6,10 +6,10 @@ from .exceptions import AlreadyQueued
class DocumentQueueManager(models.Manager): class DocumentQueueManager(models.Manager):
""" '''
Module manager class to handle adding documents to an OCR document Module manager class to handle adding documents to an OCR document
queue queue
""" '''
def queue_document(self, document, queue_name='default'): def queue_document(self, document, queue_name='default'):
document_queue = self.model.objects.get(name=queue_name) document_queue = self.model.objects.get(name=queue_name)
if document_queue.queuedocument_set.filter(document=document): if document_queue.queuedocument_set.filter(document=document):

View File

@@ -89,9 +89,9 @@ class ArgumentsValidator(object):
self.code = code self.code = code
def __call__(self, value): def __call__(self, value):
""" '''
Validates that the input evaluates correctly. Validates that the input evaluates correctly.
""" '''
value = value.strip() value = value.strip()
try: try:
literal_eval(value) literal_eval(value)
@@ -100,10 +100,10 @@ class ArgumentsValidator(object):
class QueueTransformation(models.Model): class QueueTransformation(models.Model):
""" '''
Model that stores the transformation and transformation arguments Model that stores the transformation and transformation arguments
for a given document queue for a given document queue
""" '''
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = generic.GenericForeignKey('content_type', 'object_id')

View File

@@ -5,7 +5,6 @@ from django.utils.translation import ugettext_lazy as _
from permissions.models import Permission, PermissionNamespace from permissions.models import Permission, PermissionNamespace
ocr_namespace = PermissionNamespace('ocr', _(u'OCR')) ocr_namespace = PermissionNamespace('ocr', _(u'OCR'))
PERMISSION_OCR_DOCUMENT = Permission.objects.register(ocr_namespace, 'ocr_document', _(u'Submit documents for 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_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_QUEUE_ENABLE_DISABLE = Permission.objects.register(ocr_namespace, 'ocr_queue_enable_disable', _(u'Can enable/disable the OCR queue'))