PEP8 cleanups and code style cleanups.

This commit is contained in:
Roberto Rosario
2015-07-10 17:19:36 -04:00
parent c3be4bef53
commit e891fe9525
80 changed files with 557 additions and 630 deletions
-2
View File
@@ -7,10 +7,8 @@ from django.shortcuts import get_object_or_404
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.settings import api_settings
from acls.models import AccessControlList
from common.models import SharedUploadedFile
from converter.exceptions import UnkownConvertError, UnknownFileFormat
from converter.literals import (
DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL
@@ -2,8 +2,8 @@
from __future__ import unicode_literals
from django.db import models, migrations
import documents.models
from django.conf import settings
import storage.backends.filebasedstorage
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import storage.backends.filebasedstorage
from django.db import migrations
class Migration(migrations.Migration):
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
+1 -1
View File
@@ -102,7 +102,7 @@ class Document(models.Model):
"""
uuid = models.CharField(default=UUID_FUNCTION, editable=False, max_length=48)
document_type = models.ForeignKey(DocumentType, related_name='documents', verbose_name=_('Document type'))
document_type = models.ForeignKey(DocumentType, related_name='documents', verbose_name=_('Document type'))
label = models.CharField(db_index=True, default=_('Uninitialized document'), max_length=255, help_text=_('The name of the document'), verbose_name=_('Label'))
description = models.TextField(blank=True, verbose_name=_('Description'))
date_added = models.DateTimeField(auto_now_add=True, verbose_name=_('Added'))
-1
View File
@@ -4,7 +4,6 @@ from datetime import timedelta
import logging
from django.contrib.auth.models import User
from django.core.files import File
from django.utils.timezone import now
from mayan.celery import app
+3 -9
View File
@@ -3,13 +3,9 @@
from __future__ import unicode_literals
from json import loads
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files import File
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from rest_framework import status
@@ -18,11 +14,9 @@ from rest_framework.test import APIClient
from .models import Document, DocumentType
from .test_models import (
TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME, TEST_ADMIN_EMAIL,
TEST_SMALL_DOCUMENT_FILENAME, TEST_NON_ASCII_DOCUMENT_FILENAME,
TEST_NON_ASCII_COMPRESSED_DOCUMENT_FILENAME, TEST_DOCUMENT_PATH,
TEST_SIGNED_DOCUMENT_PATH, TEST_SMALL_DOCUMENT_PATH,
TEST_NON_ASCII_DOCUMENT_PATH, TEST_NON_ASCII_COMPRESSED_DOCUMENT_PATH,
TEST_DOCUMENT_DESCRIPTION, TEST_DOCUMENT_TYPE
TEST_SMALL_DOCUMENT_FILENAME, TEST_DOCUMENT_PATH,
TEST_SMALL_DOCUMENT_PATH,
TEST_DOCUMENT_TYPE
)
-9
View File
@@ -1,20 +1,12 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from json import loads
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files import File
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from .models import DeletedDocument, Document, DocumentType
TEST_ADMIN_PASSWORD = 'test_admin_password'
@@ -24,7 +16,6 @@ TEST_SMALL_DOCUMENT_FILENAME = 'title_page.png'
TEST_NON_ASCII_DOCUMENT_FILENAME = 'I18N_title_áéíóúüñÑ.png'
TEST_NON_ASCII_COMPRESSED_DOCUMENT_FILENAME = 'I18N_title_áéíóúüñÑ.png.zip'
TEST_DOCUMENT_PATH = os.path.join(settings.BASE_DIR, 'contrib', 'sample_documents', 'mayan_11_1.pdf')
TEST_SIGNED_DOCUMENT_PATH = os.path.join(settings.BASE_DIR, 'contrib', 'sample_documents', 'mayan_11_1.pdf.gpg')
TEST_SMALL_DOCUMENT_PATH = os.path.join(settings.BASE_DIR, 'contrib', 'sample_documents', TEST_SMALL_DOCUMENT_FILENAME)
TEST_NON_ASCII_DOCUMENT_PATH = os.path.join(settings.BASE_DIR, 'contrib', 'sample_documents', TEST_NON_ASCII_DOCUMENT_FILENAME)
TEST_NON_ASCII_COMPRESSED_DOCUMENT_PATH = os.path.join(settings.BASE_DIR, 'contrib', 'sample_documents', TEST_NON_ASCII_COMPRESSED_DOCUMENT_FILENAME)
+2 -13
View File
@@ -2,27 +2,16 @@
from __future__ import unicode_literals
from json import loads
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files import File
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from .models import DeletedDocument, Document, DocumentType
from .test_models import (
TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME, TEST_ADMIN_EMAIL,
TEST_SMALL_DOCUMENT_FILENAME, TEST_NON_ASCII_DOCUMENT_FILENAME,
TEST_NON_ASCII_COMPRESSED_DOCUMENT_FILENAME, TEST_DOCUMENT_PATH,
TEST_SIGNED_DOCUMENT_PATH, TEST_SMALL_DOCUMENT_PATH,
TEST_NON_ASCII_DOCUMENT_PATH, TEST_NON_ASCII_COMPRESSED_DOCUMENT_PATH,
TEST_DOCUMENT_DESCRIPTION, TEST_DOCUMENT_TYPE
TEST_SMALL_DOCUMENT_PATH, TEST_DOCUMENT_TYPE
)
@@ -45,7 +34,7 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertTrue(logged_in)
self.assertTrue(self.admin_user.is_authenticated())
with open(TEST_DOCUMENT_PATH) as file_object:
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
self.document = self.document_type.new_document(file_object=File(file_object), label='mayan_11_1.pdf')
def tearDown(self):