PEP8 cleanups
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.contenttypes import generic
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from .models import AccessEntry
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@ from django.utils.translation import ugettext
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from common.models import AnonymousUserSingleton
|
||||
from permissions.models import Permission
|
||||
|
||||
from .classes import EncapsulatedObject, AccessHolder, ClassAccessHolder
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -131,4 +131,3 @@ def get_available_transformations_choices():
|
||||
|
||||
def get_format_list():
|
||||
return [(format, FILE_FORMATS.get(format, u'')) for format in backend.get_format_list()]
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
class ConvertError(Exception):
|
||||
'''
|
||||
"""
|
||||
Base exception for all coverter app exceptions
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class UnknownFileFormat(ConvertError):
|
||||
'''
|
||||
"""
|
||||
Raised when the converter backend can't understand a file
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class IdentifyError(ConvertError):
|
||||
'''
|
||||
"""
|
||||
Raised by the graphcismagick and imagemagics identify program
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class UnkownConvertError(ConvertError):
|
||||
'''
|
||||
"""
|
||||
Raised when an error is found but there is no disernible way to
|
||||
identify the kind of error
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DocumentVersionSignature(models.Model):
|
||||
'''
|
||||
"""
|
||||
Model that describes a document version signature properties
|
||||
'''
|
||||
"""
|
||||
document_version = models.ForeignKey(DocumentVersion, verbose_name=_(u'document version'), editable=False)
|
||||
signature_file = models.FileField(blank=True, null=True, upload_to=get_filename_from_uuid, storage=STORAGE_BACKEND(), verbose_name=_(u'signature file'), editable=False)
|
||||
has_embedded_signature = models.BooleanField(default=False, verbose_name=_(u'has embedded signature'), editable=False)
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -193,7 +193,6 @@ def folder_add_document(request, document_id):
|
||||
else:
|
||||
form = FolderListForm(user=request.user)
|
||||
|
||||
|
||||
return render_to_response('generic_form.html', {
|
||||
'title': _(u'add document "%s" to a folder') % document,
|
||||
'form': form,
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'''Metadata handling commonalities'''
|
||||
"""Metadata handling commonalities"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from urllib import unquote_plus
|
||||
@@ -9,9 +9,9 @@ from .models import DocumentMetadata, MetadataType
|
||||
|
||||
|
||||
def decode_metadata_from_url(url_dict):
|
||||
'''
|
||||
"""
|
||||
Parse a URL query string to a list of metadata
|
||||
'''
|
||||
"""
|
||||
metadata_dict = {
|
||||
'id': {},
|
||||
'value': {}
|
||||
@@ -35,19 +35,19 @@ def decode_metadata_from_url(url_dict):
|
||||
|
||||
|
||||
def save_metadata_list(metadata_list, document, create=False):
|
||||
'''
|
||||
"""
|
||||
Take a list of metadata dictionaries and associate them to a
|
||||
document
|
||||
'''
|
||||
"""
|
||||
for item in metadata_list:
|
||||
save_metadata(item, document, create)
|
||||
|
||||
|
||||
def save_metadata(metadata_dict, document, create=False):
|
||||
'''
|
||||
"""
|
||||
Take a dictionary of metadata type & value and associate it to a
|
||||
document
|
||||
'''
|
||||
"""
|
||||
if create:
|
||||
# Use matched metadata now to create document metadata
|
||||
document_metadata, created = DocumentMetadata.objects.get_or_create(
|
||||
@@ -81,16 +81,16 @@ def save_metadata(metadata_dict, document, create=False):
|
||||
|
||||
|
||||
def metadata_repr(metadata_list):
|
||||
'''
|
||||
"""
|
||||
Return a printable representation of a metadata list
|
||||
'''
|
||||
"""
|
||||
return u', '.join(metadata_repr_as_list(metadata_list))
|
||||
|
||||
|
||||
def metadata_repr_as_list(metadata_list):
|
||||
'''
|
||||
"""
|
||||
Turn a list of metadata into a list of printable representations
|
||||
'''
|
||||
"""
|
||||
output = []
|
||||
for metadata_dict in metadata_list:
|
||||
try:
|
||||
@@ -103,7 +103,7 @@ def metadata_repr_as_list(metadata_list):
|
||||
|
||||
|
||||
def get_metadata_string(document):
|
||||
'''
|
||||
"""
|
||||
Return a formated representation of a document's metadata values
|
||||
'''
|
||||
"""
|
||||
return u', '.join([u'%s - %s' % (metadata.metadata_type, metadata.value) for metadata in DocumentMetadata.objects.filter(document=document).select_related('metadata_type')])
|
||||
|
||||
@@ -12,9 +12,9 @@ available_functions_string = (_(u' Available functions: %s') % u','.join([u'%s()
|
||||
|
||||
|
||||
class MetadataType(models.Model):
|
||||
'''
|
||||
"""
|
||||
Define a type of metadata
|
||||
'''
|
||||
"""
|
||||
name = models.CharField(unique=True, max_length=48, verbose_name=_(u'name'), help_text=_(u'Do not use python reserved words, or spaces.'))
|
||||
title = models.CharField(max_length=48, verbose_name=_(u'title'), blank=True, null=True)
|
||||
default = models.CharField(max_length=128, blank=True, null=True,
|
||||
@@ -35,9 +35,9 @@ class MetadataType(models.Model):
|
||||
|
||||
|
||||
class MetadataSet(models.Model):
|
||||
'''
|
||||
"""
|
||||
Define a group of metadata types
|
||||
'''
|
||||
"""
|
||||
title = models.CharField(max_length=48, verbose_name=_(u'title'))
|
||||
|
||||
def __unicode__(self):
|
||||
@@ -50,10 +50,10 @@ class MetadataSet(models.Model):
|
||||
|
||||
|
||||
class MetadataSetItem(models.Model):
|
||||
'''
|
||||
"""
|
||||
Define the set of metadata that relates to a set or group of
|
||||
metadata fields
|
||||
'''
|
||||
"""
|
||||
metadata_set = models.ForeignKey(MetadataSet, verbose_name=_(u'metadata set'))
|
||||
metadata_type = models.ForeignKey(MetadataType, verbose_name=_(u'metadata type'))
|
||||
#required = models.BooleanField(default=True, verbose_name=_(u'required'))
|
||||
@@ -67,10 +67,10 @@ class MetadataSetItem(models.Model):
|
||||
|
||||
|
||||
class DocumentMetadata(models.Model):
|
||||
'''
|
||||
"""
|
||||
Link a document to a specific instance of a metadata type with it's
|
||||
current value
|
||||
'''
|
||||
"""
|
||||
document = models.ForeignKey(Document, verbose_name=_(u'document'))
|
||||
metadata_type = models.ForeignKey(MetadataType, verbose_name=_(u'type'))
|
||||
value = models.CharField(max_length=256, blank=True, verbose_name=_(u'value'), db_index=True)
|
||||
@@ -84,10 +84,10 @@ class DocumentMetadata(models.Model):
|
||||
|
||||
|
||||
class DocumentTypeDefaults(models.Model):
|
||||
'''
|
||||
"""
|
||||
Default preselected metadata types and metadata set per document
|
||||
type
|
||||
'''
|
||||
"""
|
||||
document_type = models.ForeignKey(DocumentType, verbose_name=_(u'document type'))
|
||||
default_metadata_sets = models.ManyToManyField(MetadataSet, blank=True, verbose_name=_(u'default metadata sets'))
|
||||
default_metadata = models.ManyToManyField(MetadataType, blank=True, verbose_name=_(u'default metadata'))
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ 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, PERMISSION_OCR_QUEUE_EDIT)
|
||||
PERMISSION_OCR_CLEAN_ALL_PAGES)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from project_setup.api import register_setup
|
||||
|
||||
|
||||
def is_superuser(context):
|
||||
return context['request'].user.is_staff or context['request'].user.is_superuser
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ Another way to test that 1 + 1 is equal to 2.
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TagForm(forms.Form):
|
||||
'''
|
||||
"""
|
||||
Form to edit an existing tag's properties
|
||||
'''
|
||||
"""
|
||||
name = forms.CharField(label=_(u'Name'))
|
||||
color = forms.ChoiceField(choices=COLOR_CHOICES, label=_(u'Color'))
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ from django.utils.safestring import mark_safe
|
||||
|
||||
|
||||
def get_tags_inline_widget(document):
|
||||
'''
|
||||
"""
|
||||
A tag widget that includes the total tag count for a given document
|
||||
'''
|
||||
"""
|
||||
tags_template = []
|
||||
tag_count = document.tags.count()
|
||||
if tag_count:
|
||||
@@ -20,10 +20,10 @@ def get_tags_inline_widget(document):
|
||||
|
||||
|
||||
def get_tags_inline_widget_simple(document):
|
||||
'''
|
||||
"""
|
||||
A tag widget that only displayes the rectangular colored boxes for a
|
||||
given document
|
||||
'''
|
||||
"""
|
||||
tags_template = []
|
||||
|
||||
tag_count = document.tags.count()
|
||||
|
||||
Reference in New Issue
Block a user