diff --git a/mayan/apps/app_registry/__init__.py b/mayan/apps/app_registry/__init__.py index 4020e8369d..8ba2fa6c90 100644 --- a/mayan/apps/app_registry/__init__.py +++ b/mayan/apps/app_registry/__init__.py @@ -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() diff --git a/mayan/apps/common/literals.py b/mayan/apps/common/literals.py deleted file mode 100644 index bd6655ad83..0000000000 --- a/mayan/apps/common/literals.py +++ /dev/null @@ -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')), -) diff --git a/mayan/apps/common/utils.py b/mayan/apps/common/utils.py index f306d41f4f..68e3c98127 100644 --- a/mayan/apps/common/utils.py +++ b/mayan/apps/common/utils.py @@ -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) ] diff --git a/mayan/apps/document_indexing/serializers.py b/mayan/apps/document_indexing/serializers.py index f664641734..41b7ae10e5 100644 --- a/mayan/apps/document_indexing/serializers.py +++ b/mayan/apps/document_indexing/serializers.py @@ -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') diff --git a/mayan/apps/document_signatures/views.py b/mayan/apps/document_signatures/views.py index 54e9c0bac3..01c6b54ca8 100644 --- a/mayan/apps/document_signatures/views.py +++ b/mayan/apps/document_signatures/views.py @@ -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 diff --git a/mayan/apps/documents/literals.py b/mayan/apps/documents/literals.py index 623a80e17d..9e1f2a2aef 100644 --- a/mayan/apps/documents/literals.py +++ b/mayan/apps/documents/literals.py @@ -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' diff --git a/mayan/apps/documents/views.py b/mayan/apps/documents/views.py index 63b75ba10c..4f327ed848 100644 --- a/mayan/apps/documents/views.py +++ b/mayan/apps/documents/views.py @@ -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 diff --git a/mayan/apps/dynamic_search/api_views.py b/mayan/apps/dynamic_search/api_views.py index bf68f8d200..39df548a5d 100644 --- a/mayan/apps/dynamic_search/api_views.py +++ b/mayan/apps/dynamic_search/api_views.py @@ -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 diff --git a/mayan/apps/dynamic_search/south_migrations/0001_initial.py b/mayan/apps/dynamic_search/south_migrations/0001_initial.py index b69b60b81a..dcdae0b4ff 100644 --- a/mayan/apps/dynamic_search/south_migrations/0001_initial.py +++ b/mayan/apps/dynamic_search/south_migrations/0001_initial.py @@ -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'}, @@ -71,4 +68,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['dynamic_search'] \ No newline at end of file + complete_apps = ['dynamic_search'] diff --git a/mayan/apps/dynamic_search/south_migrations/0002_auto__chg_field_recentsearch_datetime_created__add_index_recentsearch_.py b/mayan/apps/dynamic_search/south_migrations/0002_auto__chg_field_recentsearch_datetime_created__add_index_recentsearch_.py index 6194cb8b9b..6f34c7eedf 100644 --- a/mayan/apps/dynamic_search/south_migrations/0002_auto__chg_field_recentsearch_datetime_created__add_index_recentsearch_.py +++ b/mayan/apps/dynamic_search/south_migrations/0002_auto__chg_field_recentsearch_datetime_created__add_index_recentsearch_.py @@ -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')()) @@ -70,4 +67,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['dynamic_search'] \ No newline at end of file + complete_apps = ['dynamic_search'] diff --git a/mayan/apps/history/models.py b/mayan/apps/history/models.py index a19bced3f1..9c49deab81 100644 --- a/mayan/apps/history/models.py +++ b/mayan/apps/history/models.py @@ -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 diff --git a/mayan/apps/lock_manager/tests.py b/mayan/apps/lock_manager/tests.py index 50364a2b94..892daded54 100644 --- a/mayan/apps/lock_manager/tests.py +++ b/mayan/apps/lock_manager/tests.py @@ -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): diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index 9c11553690..0aea4123c4 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -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 diff --git a/mayan/apps/metadata/views.py b/mayan/apps/metadata/views.py index b67eb41628..2f5a87fc70 100644 --- a/mayan/apps/metadata/views.py +++ b/mayan/apps/metadata/views.py @@ -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 diff --git a/mayan/apps/permissions/models.py b/mayan/apps/permissions/models.py index a8745d9cc9..86484ca3bb 100644 --- a/mayan/apps/permissions/models.py +++ b/mayan/apps/permissions/models.py @@ -195,8 +195,8 @@ class StoredPermission(models.Model): class PermissionHolder(models.Model): permission = models.ForeignKey(StoredPermission, verbose_name=_(u'Permission')) holder_type = models.ForeignKey(ContentType, - related_name='permission_holder', - limit_choices_to={'model__in': ('user', 'group', 'role')}) + related_name='permission_holder', + limit_choices_to={'model__in': ('user', 'group', 'role')}) holder_id = models.PositiveIntegerField() holder_object = generic.GenericForeignKey(ct_field='holder_type', fk_field='holder_id') @@ -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': ( diff --git a/mayan/apps/permissions/widgets.py b/mayan/apps/permissions/widgets.py index 8f2594be17..4ee2b27d01 100644 --- a/mayan/apps/permissions/widgets.py +++ b/mayan/apps/permissions/widgets.py @@ -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')}) diff --git a/mayan/apps/sources/utils.py b/mayan/apps/sources/utils.py index 68e1023705..bed2f3a48a 100644 --- a/mayan/apps/sources/utils.py +++ b/mayan/apps/sources/utils.py @@ -1,5 +1,3 @@ -import re - from .forms import (POP3EmailSetupForm, IMAPEmailSetupForm, StagingFolderSetupForm, WatchFolderSetupForm, WebFormSetupForm) diff --git a/mayan/apps/tags/forms.py b/mayan/apps/tags/forms.py index 7c40e0283c..51f3a30ae0 100644 --- a/mayan/apps/tags/forms.py +++ b/mayan/apps/tags/forms.py @@ -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 diff --git a/mayan/apps/tags/south_migrations/0001_initial.py b/mayan/apps/tags/south_migrations/0001_initial.py index d4064e2462..3a5d55647c 100644 --- a/mayan/apps/tags/south_migrations/0001_initial.py +++ b/mayan/apps/tags/south_migrations/0001_initial.py @@ -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'}, @@ -37,4 +34,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['tags'] \ No newline at end of file + complete_apps = ['tags'] diff --git a/mayan/apps/tags/south_migrations/0002_auto__add_tag__chg_field_tagproperties_tag.py b/mayan/apps/tags/south_migrations/0002_auto__add_tag__chg_field_tagproperties_tag.py index e2ec99c6d8..ec4d9a330d 100644 --- a/mayan/apps/tags/south_migrations/0002_auto__add_tag__chg_field_tagproperties_tag.py +++ b/mayan/apps/tags/south_migrations/0002_auto__add_tag__chg_field_tagproperties_tag.py @@ -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'])) @@ -69,4 +66,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['tags'] \ No newline at end of file + complete_apps = ['tags'] diff --git a/mayan/apps/tags/south_migrations/0003_remove_taggit.py b/mayan/apps/tags/south_migrations/0003_remove_taggit.py index 5a1327f2ec..3fd16acabd 100644 --- a/mayan/apps/tags/south_migrations/0003_remove_taggit.py +++ b/mayan/apps/tags/south_migrations/0003_remove_taggit.py @@ -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 diff --git a/mayan/apps/tags/south_migrations/0004_auto.py b/mayan/apps/tags/south_migrations/0004_auto.py index 56bd03eeaa..1ff7232adf 100644 --- a/mayan/apps/tags/south_migrations/0004_auto.py +++ b/mayan/apps/tags/south_migrations/0004_auto.py @@ -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'}, @@ -64,4 +61,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['tags'] \ No newline at end of file + complete_apps = ['tags'] diff --git a/mayan/apps/tags/south_migrations/0005_auto__add_unique_tag_label.py b/mayan/apps/tags/south_migrations/0005_auto__add_unique_tag_label.py index 19a69961b1..b00980ab17 100644 --- a/mayan/apps/tags/south_migrations/0005_auto__add_unique_tag_label.py +++ b/mayan/apps/tags/south_migrations/0005_auto__add_unique_tag_label.py @@ -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'}, @@ -46,4 +43,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['tags'] \ No newline at end of file + complete_apps = ['tags'] diff --git a/mayan/apps/tags/south_migrations/0006_auto__del_tagproperties.py b/mayan/apps/tags/south_migrations/0006_auto__del_tagproperties.py index c52e14df9d..0e96240c77 100644 --- a/mayan/apps/tags/south_migrations/0006_auto__del_tagproperties.py +++ b/mayan/apps/tags/south_migrations/0006_auto__del_tagproperties.py @@ -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'}, @@ -45,4 +42,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['tags'] \ No newline at end of file + complete_apps = ['tags']