PEP8 cleanups.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.urls import resolve, reverse
|
||||
from django.urls import reverse
|
||||
|
||||
from documents.tests.test_views import GenericDocumentViewTestCase
|
||||
from user_management.tests.literals import (
|
||||
|
||||
@@ -83,7 +83,7 @@ def password_reset_complete_view(request):
|
||||
|
||||
return password_reset_complete(
|
||||
request, extra_context=extra_context,
|
||||
template_name= 'authentication/password_reset_complete.html'
|
||||
template_name='authentication/password_reset_complete.html'
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
|
||||
from kombu import Exchange, Queue
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from django_downloadview import (
|
||||
)
|
||||
from pure_pagination.mixins import PaginationMixin
|
||||
|
||||
from .forms import ChoiceForm, DynamicForm
|
||||
from .forms import ChoiceForm
|
||||
from .mixins import (
|
||||
DeleteExtraDataMixin, DynamicFormViewMixin, ExtraContextMixin,
|
||||
FormExtraKwargsMixin, MultipleObjectMixin, ObjectActionMixin,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.core import management
|
||||
from django.db.utils import OperationalError
|
||||
|
||||
from ...signals import post_initial_setup, pre_initial_setup
|
||||
|
||||
|
||||
@@ -30,6 +30,3 @@ class Command(management.BaseCommand):
|
||||
raise CommandError(
|
||||
'Error during post_upgrade signal; %s' % exception
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,4 +7,3 @@ post_initial_setup = Signal(use_caching=True)
|
||||
post_upgrade = Signal(use_caching=True)
|
||||
pre_initial_setup = Signal(use_caching=True)
|
||||
pre_upgrade = Signal(use_caching=True)
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ class WorkflowState(models.Model):
|
||||
'workflow_instance', flat=True
|
||||
)
|
||||
) | Q(
|
||||
workflows__log_entries__isnull=True,
|
||||
workflows__workflow__states=self,
|
||||
workflows__workflow__states__initial=True
|
||||
)
|
||||
workflows__log_entries__isnull=True,
|
||||
workflows__workflow__states=self,
|
||||
workflows__workflow__states__initial=True
|
||||
)
|
||||
).distinct()
|
||||
|
||||
|
||||
|
||||
@@ -19,19 +19,22 @@ class Migration(migrations.Migration):
|
||||
(
|
||||
'id', models.AutoField(
|
||||
auto_created=True, primary_key=True, serialize=False,
|
||||
verbose_name='ID')
|
||||
),
|
||||
verbose_name='ID'
|
||||
)
|
||||
),
|
||||
(
|
||||
'datetime_added', models.DateTimeField(
|
||||
auto_now_add=True, db_index=True,
|
||||
verbose_name='Added')
|
||||
),
|
||||
verbose_name='Added'
|
||||
)
|
||||
),
|
||||
(
|
||||
'document', models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name='duplicates', to='documents.Document',
|
||||
verbose_name='Document')
|
||||
),
|
||||
verbose_name='Document'
|
||||
)
|
||||
),
|
||||
(
|
||||
'documents', models.ManyToManyField(
|
||||
to='documents.Document',
|
||||
|
||||
@@ -33,6 +33,7 @@ from .literals import (
|
||||
TEST_TRANSFORMATION_NAME, TEST_VERSION_COMMENT
|
||||
)
|
||||
|
||||
|
||||
@override_settings(OCR_AUTO_OCR=False)
|
||||
class GenericDocumentViewTestCase(GenericViewTestCase):
|
||||
def setUp(self):
|
||||
@@ -606,7 +607,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
|
||||
# Grant the document type view permission so that the post create
|
||||
# redirect works
|
||||
self.grant_permission(permission=permission_document_type_view)
|
||||
response = self._request_document_type_create()
|
||||
self._request_document_type_create()
|
||||
|
||||
self.assertEqual(DocumentType.objects.count(), 0)
|
||||
|
||||
@@ -669,7 +670,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
|
||||
)
|
||||
|
||||
def test_document_type_edit_view_no_permission(self):
|
||||
response = self._request_document_type_edit()
|
||||
self._request_document_type_edit()
|
||||
|
||||
self.assertEqual(
|
||||
DocumentType.objects.get(pk=self.document_type.pk).label,
|
||||
@@ -781,7 +782,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
|
||||
self.grant_access(
|
||||
obj=self.document_type, permission=permission_document_type_view
|
||||
)
|
||||
response = self._request_quick_label_delete()
|
||||
self._request_quick_label_delete()
|
||||
|
||||
self.assertEqual(
|
||||
self.document_type.filenames.count(), 1
|
||||
@@ -807,6 +808,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
|
||||
self.document_type.filenames.count(), 0
|
||||
)
|
||||
|
||||
|
||||
class DocumentVersionTestCase(GenericDocumentViewTestCase):
|
||||
def setUp(self):
|
||||
super(DocumentVersionTestCase, self).setUp()
|
||||
|
||||
@@ -12,7 +12,7 @@ from common.generics import ConfirmView, SingleObjectListView
|
||||
from ..models import Document, DocumentVersion
|
||||
from ..permissions import (
|
||||
permission_document_download, permission_document_version_revert,
|
||||
permission_document_version_view, permission_document_view
|
||||
permission_document_version_view
|
||||
)
|
||||
|
||||
from .document_views import DocumentDownloadFormView, DocumentDownloadView
|
||||
|
||||
@@ -2,8 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from .classes import SearchField, SearchModel
|
||||
|
||||
|
||||
class SearchFieldSerializer(serializers.Serializer):
|
||||
field = serializers.CharField(read_only=True)
|
||||
|
||||
@@ -11,7 +11,7 @@ class ModelLock(LockingBackend):
|
||||
super(ModelLock, cls).acquire_lock(name=name, timeout=timeout)
|
||||
Lock = apps.get_model(app_label='lock_manager', model_name='Lock')
|
||||
return ModelLock(
|
||||
model_instance = Lock.objects.acquire_lock(
|
||||
model_instance=Lock.objects.acquire_lock(
|
||||
name=name, timeout=timeout
|
||||
)
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ class DjangoSMTP(MailerBackend):
|
||||
'help_text': _('The host to use for sending email.'),
|
||||
'kwargs': {
|
||||
'max_length': 48
|
||||
}, 'required': False
|
||||
}, 'required': False
|
||||
},
|
||||
{
|
||||
'name': 'port', 'label': _('Port'),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.html import format_html_join
|
||||
|
||||
|
||||
@@ -8,7 +9,9 @@ def get_metadata_string(document):
|
||||
"""
|
||||
return format_html_join(
|
||||
'\n', '<div class="metadata-display"><b>{}: </b><span data-metadata-type="{}" data-pk="{}">{}</span></div>',
|
||||
((document_metadata.metadata_type,document_metadata.metadata_type_id,document_metadata.id,document_metadata.value)
|
||||
for document_metadata in document.metadata.all()
|
||||
(
|
||||
(
|
||||
document_metadata.metadata_type, document_metadata.metadata_type_id, document_metadata.id, document_metadata.value
|
||||
) for document_metadata in document.metadata.all()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -240,7 +240,7 @@ class Command(management.BaseCommand):
|
||||
allow_other=options['allow_other'],
|
||||
allow_root=options['allow_root']
|
||||
)
|
||||
except RuntimeError as exception:
|
||||
except RuntimeError:
|
||||
if options['allow_other'] or options['allow_root']:
|
||||
raise CommandError(
|
||||
'Make sure \'user_allow_other\' is set in /etc/fuse.conf'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import override_settings
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from documents.tests.test_views import GenericDocumentViewTestCase
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import conditional_escape
|
||||
|
||||
from .models import DocumentPageContent
|
||||
|
||||
|
||||
def get_document_ocr_content(document):
|
||||
for page in document.pages.all():
|
||||
|
||||
@@ -60,8 +60,6 @@ class WritableRoleSerializer(serializers.HyperlinkedModelSerializer):
|
||||
model = Role
|
||||
|
||||
def create(self, validated_data):
|
||||
result = validated_data.copy()
|
||||
|
||||
self.groups_pk_list = validated_data.pop('groups_pk_list', '')
|
||||
self.permissions_pk_list = validated_data.pop(
|
||||
'permissions_pk_list', ''
|
||||
|
||||
@@ -126,7 +126,6 @@ class Source(models.Model):
|
||||
document.delete(to_trash=False)
|
||||
raise
|
||||
|
||||
|
||||
def handle_upload(self, file_object, description=None, document_type=None, expand=False, label=None, language=None, metadata_dict_list=None, metadata_dictionary=None, user=None):
|
||||
if not document_type:
|
||||
document_type = self.document_type
|
||||
|
||||
@@ -12,7 +12,7 @@ from common.utils import fs_cleanup, mkdtemp
|
||||
from documents.models import Document, DocumentType
|
||||
from documents.permissions import permission_document_create
|
||||
from documents.tests import (
|
||||
TEST_DOCUMENT_DESCRIPTION, TEST_SMALL_DOCUMENT_PATH, TEST_DOCUMENT_TYPE_LABEL,
|
||||
TEST_DOCUMENT_DESCRIPTION, TEST_DOCUMENT_TYPE_LABEL,
|
||||
TEST_SMALL_DOCUMENT_CHECKSUM, TEST_SMALL_DOCUMENT_PATH
|
||||
)
|
||||
from documents.tests.test_views import GenericDocumentViewTestCase
|
||||
|
||||
@@ -3,7 +3,6 @@ from __future__ import absolute_import, unicode_literals
|
||||
from django import forms
|
||||
from django.apps import apps
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import escape
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
Reference in New Issue
Block a user