PEP8 cleanups, further removal of unused code
This commit is contained in:
@@ -14,10 +14,6 @@ def register_apps():
|
||||
for app_name in settings.INSTALLED_APPS:
|
||||
logger.debug('registering: %s' % app_name)
|
||||
App.register(app_name)
|
||||
try:
|
||||
post_init = import_module('%s.post_init' % app_name)
|
||||
except ImportError:
|
||||
logger.debug('Unable to import post_init module from: %s' % app_name)
|
||||
|
||||
|
||||
register_apps()
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
PAGE_ORIENTATION_PORTRAIT = u'portrait'
|
||||
PAGE_ORIENTATION_LANDSCAPE = u'landscape'
|
||||
|
||||
PAGE_ORIENTATION_CHOICES = (
|
||||
(PAGE_ORIENTATION_PORTRAIT, _(u'Portrait')),
|
||||
(PAGE_ORIENTATION_LANDSCAPE, _(u'Landscape')),
|
||||
)
|
||||
@@ -87,7 +87,7 @@ def return_attrib(obj, attrib, arguments=None):
|
||||
# http://snippets.dzone.com/posts/show/5434
|
||||
# http://snippets.dzone.com/user/jakob
|
||||
def pretty_size(size, suffixes=None):
|
||||
suffixes = suffixes if not suffixes is None else [
|
||||
suffixes = suffixes or [
|
||||
(u'B', 1024L), (u'K', 1048576L), (u'M', 1073741824L),
|
||||
(u'G', 1099511627776L), (u'T', 1125899906842624L)
|
||||
]
|
||||
|
||||
@@ -5,7 +5,6 @@ from rest_framework import serializers
|
||||
from .models import Index, IndexInstanceNode, IndexTemplateNode
|
||||
|
||||
|
||||
|
||||
class IndexInstanceNodeSerializer(serializers.ModelSerializer):
|
||||
documents = serializers.HyperlinkedIdentityField(view_name='index-node-documents')
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ from __future__ import absolute_import
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
PICTURE_ERROR_SMALL = u'picture_error.png'
|
||||
PICTURE_ERROR_MEDIUM = u'1297211435_error.png'
|
||||
PICTURE_UNKNOWN_SMALL = u'1299549572_unknown2.png'
|
||||
|
||||
@@ -18,7 +18,6 @@ import sendfile
|
||||
|
||||
from acls.models import AccessEntry
|
||||
from common.compressed_files import CompressedFile
|
||||
from common.literals import PAGE_ORIENTATION_LANDSCAPE, PAGE_ORIENTATION_PORTRAIT
|
||||
from common.utils import (encapsulate, pretty_size, parse_range, return_diff,
|
||||
urlquote)
|
||||
from common.views import SingleObjectListView
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from rest_framework import generics, status
|
||||
from rest_framework import generics
|
||||
from rest_framework.exceptions import ParseError
|
||||
from rest_framework.response import Response
|
||||
|
||||
from acls.models import AccessEntry
|
||||
from permissions.models import Permission
|
||||
from rest_api.filters import MayanObjectPermissionsFilter
|
||||
from rest_api.permissions import MayanPermission
|
||||
|
||||
from .classes import SearchModel
|
||||
from .models import RecentSearch
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -18,12 +17,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'dynamic_search', ['RecentSearch'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'RecentSearch'
|
||||
db.delete_table(u'dynamic_search_recentsearch')
|
||||
|
||||
|
||||
models = {
|
||||
u'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -14,12 +13,10 @@ class Migration(SchemaMigration):
|
||||
# Adding index on 'RecentSearch', fields ['datetime_created']
|
||||
db.create_index(u'dynamic_search_recentsearch', ['datetime_created'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing index on 'RecentSearch', fields ['datetime_created']
|
||||
db.delete_index(u'dynamic_search_recentsearch', ['datetime_created'])
|
||||
|
||||
|
||||
# Changing field 'RecentSearch.datetime_created'
|
||||
db.alter_column(u'dynamic_search_recentsearch', 'datetime_created', self.gf('django.db.models.fields.DateTimeField')())
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.contrib.contenttypes import generic
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core import serializers
|
||||
from django.db import models
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from .models import Lock
|
||||
|
||||
# Notice: StaleLock exception and tests are not available until more changes are
|
||||
# backported.
|
||||
# TODO: backport stale lock code
|
||||
|
||||
|
||||
class LockTestCase(TestCase):
|
||||
|
||||
@@ -4,9 +4,7 @@ from django import forms
|
||||
from django.forms.formsets import formset_factory
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.widgets import ScrollableCheckboxSelectMultiple
|
||||
|
||||
from .models import DocumentTypeDefaults, MetadataType
|
||||
from .models import MetadataType
|
||||
from .settings import AVAILABLE_FUNCTIONS, AVAILABLE_MODELS, AVAILABLE_VALIDATORS
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from documents.models import Document, DocumentType
|
||||
from documents.permissions import PERMISSION_DOCUMENT_TYPE_EDIT
|
||||
from permissions.models import Permission
|
||||
|
||||
from common.utils import encapsulate, generate_choices_w_labels, get_object_name
|
||||
from common.utils import get_object_name
|
||||
from common.views import assign_remove
|
||||
|
||||
from .api import save_metadata_list
|
||||
|
||||
@@ -246,7 +246,8 @@ class Role(models.Model):
|
||||
|
||||
class RoleMember(models.Model):
|
||||
role = models.ForeignKey(Role, verbose_name=_(u'Role'))
|
||||
member_type = models.ForeignKey(ContentType,
|
||||
member_type = models.ForeignKey(
|
||||
ContentType,
|
||||
related_name='role_member',
|
||||
limit_choices_to={
|
||||
'model__in': (
|
||||
|
||||
@@ -12,10 +12,12 @@ def role_permission_link(requester, permission, permission_list):
|
||||
if permission in permission_list:
|
||||
return mark_safe(template % {
|
||||
'url': reverse('permission_revoke',
|
||||
args=[permission.pk, ct.app_label, ct.model, requester.pk]),
|
||||
args=[permission.pk, ct.app_label, ct.model,
|
||||
requester.pk]),
|
||||
'icon': u'key_delete', 'text': ugettext(u'Revoke')})
|
||||
else:
|
||||
return mark_safe(template % {
|
||||
'url': reverse('permission_grant',
|
||||
args=[permission.pk, ct.app_label, ct.model, requester.pk]),
|
||||
args=[permission.pk, ct.app_label, ct.model,
|
||||
requester.pk]),
|
||||
'icon': u'key_add', 'text': ugettext(u'Grant')})
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import re
|
||||
|
||||
from .forms import (POP3EmailSetupForm, IMAPEmailSetupForm,
|
||||
StagingFolderSetupForm, WatchFolderSetupForm,
|
||||
WebFormSetupForm)
|
||||
|
||||
@@ -9,7 +9,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from acls.models import AccessEntry
|
||||
from permissions.models import Permission
|
||||
|
||||
from .literals import COLOR_CHOICES
|
||||
from .models import Tag
|
||||
from .permissions import PERMISSION_TAG_VIEW
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -16,12 +15,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'tags', ['TagProperties'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'TagProperties'
|
||||
db.delete_table(u'tags_tagproperties')
|
||||
|
||||
|
||||
models = {
|
||||
u'taggit.tag': {
|
||||
'Meta': {'object_name': 'Tag'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -25,7 +24,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.create_unique(m2m_table_name, ['tag_id', 'document_id'])
|
||||
|
||||
|
||||
# Changing field 'TagProperties.tag'
|
||||
db.alter_column(u'tags_tagproperties', 'tag_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['tags.Tag']))
|
||||
|
||||
@@ -36,7 +34,6 @@ class Migration(SchemaMigration):
|
||||
# Removing M2M table for field document on 'Tag'
|
||||
db.delete_table(db.shorten_name(u'tags_tag_document'))
|
||||
|
||||
|
||||
# Changing field 'TagProperties.tag'
|
||||
db.alter_column(u'tags_tagproperties', 'tag_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['taggit.Tag']))
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import DataMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -20,7 +19,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.create_unique(m2m_table_name, ['tag_id', 'document_id'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding M2M table for field document on 'Tag'
|
||||
m2m_table_name = db.shorten_name(u'tags_tag_document')
|
||||
@@ -34,7 +32,6 @@ class Migration(SchemaMigration):
|
||||
# Removing M2M table for field documents on 'Tag'
|
||||
db.delete_table(db.shorten_name(u'tags_tag_documents'))
|
||||
|
||||
|
||||
models = {
|
||||
u'documents.document': {
|
||||
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -11,12 +10,10 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'Tag', fields ['label']
|
||||
db.create_unique(u'tags_tag', ['label'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing unique constraint on 'Tag', fields ['label']
|
||||
db.delete_unique(u'tags_tag', ['label'])
|
||||
|
||||
|
||||
models = {
|
||||
u'documents.document': {
|
||||
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -11,7 +10,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'TagProperties'
|
||||
db.delete_table(u'tags_tagproperties')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding model 'TagProperties'
|
||||
db.create_table(u'tags_tagproperties', (
|
||||
@@ -21,7 +19,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'tags', ['TagProperties'])
|
||||
|
||||
|
||||
models = {
|
||||
u'documents.document': {
|
||||
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
|
||||
|
||||
Reference in New Issue
Block a user