From de65d96fe265ce5ece37f8986f4ffdfd7ea83291 Mon Sep 17 00:00:00 2001 From: Michael Price Date: Wed, 14 Mar 2018 21:39:14 -0400 Subject: [PATCH] Update cabinets and document_index api views docstrings. Update multi level docstrings as per Python best practices. Signed-off-by: Michael Price --- mayan/apps/acls/tests/test_views.py | 2 - mayan/apps/cabinets/api_views.py | 1 - mayan/apps/cabinets/tests/test_api.py | 1 - mayan/apps/checkouts/handlers.py | 1 - mayan/apps/checkouts/widgets.py | 1 - mayan/apps/common/forms.py | 2 - mayan/apps/common/mixins.py | 4 - mayan/apps/common/templatetags/common_tags.py | 1 - mayan/apps/common/views.py | 1 - mayan/apps/converter/managers.py | 1 - mayan/apps/converter/validators.py | 1 - mayan/apps/document_indexing/api_views.py | 2 - mayan/apps/document_indexing/views.py | 1 - mayan/apps/document_indexing/widgets.py | 2 - mayan/apps/document_parsing/parsers.py | 2 - mayan/apps/document_signatures/models.py | 1 - mayan/apps/document_states/api_views.py | 3 - mayan/apps/documents/api_views.py | 1 - mayan/apps/documents/forms.py | 1 - mayan/apps/documents/models.py | 1 - mayan/apps/documents/tests/test_models.py | 2 - .../apps/dynamic_search/tests/test_models.py | 1 - mayan/apps/dynamic_search/tests/test_views.py | 1 - mayan/apps/metadata/api_views.py | 168 ++++-------------- mayan/apps/metadata/models.py | 2 - mayan/apps/metadata/tests/test_models.py | 1 - mayan/apps/motd/api_views.py | 52 ++---- mayan/apps/navigation/classes.py | 2 - mayan/apps/ocr/tests/test_api.py | 1 - mayan/apps/rest_api/tests/base.py | 1 - mayan/apps/sources/api_views.py | 1 - mayan/apps/sources/tests/test_views.py | 2 - mayan/apps/sources/wizards.py | 1 - mayan/conf.py | 1 - mayan/wsgi.py | 1 - 35 files changed, 40 insertions(+), 227 deletions(-) diff --git a/mayan/apps/acls/tests/test_views.py b/mayan/apps/acls/tests/test_views.py index 338808b945..7c77c7b734 100644 --- a/mayan/apps/acls/tests/test_views.py +++ b/mayan/apps/acls/tests/test_views.py @@ -82,7 +82,6 @@ class AccessControlListViewTestCase(GenericDocumentViewTestCase): Test creating a duplicate ACL entry: same object & role Result: Should redirect to existing ACL for object + role combination """ - acl = AccessControlList.objects.create( content_object=self.document, role=self.role ) @@ -110,7 +109,6 @@ class AccessControlListViewTestCase(GenericDocumentViewTestCase): Test creating an ACL entry for an object with no model permissions. Result: Should display a blank permissions list (not optgroup) """ - self.login_user() self.role.permissions.add( diff --git a/mayan/apps/cabinets/api_views.py b/mayan/apps/cabinets/api_views.py index 4f221ef0ce..2bf075a55e 100644 --- a/mayan/apps/cabinets/api_views.py +++ b/mayan/apps/cabinets/api_views.py @@ -27,7 +27,6 @@ class APIDocumentCabinetListView(generics.ListAPIView): """ Returns a list of all the cabinets to which a document belongs. """ - serializer_class = CabinetSerializer filter_backends = (MayanObjectPermissionsFilter,) diff --git a/mayan/apps/cabinets/tests/test_api.py b/mayan/apps/cabinets/tests/test_api.py index 4205fcf865..98cf912019 100644 --- a/mayan/apps/cabinets/tests/test_api.py +++ b/mayan/apps/cabinets/tests/test_api.py @@ -23,7 +23,6 @@ class CabinetAPITestCase(APITestCase): """ Test the cabinet API endpoints """ - def setUp(self): super(CabinetAPITestCase, self).setUp() diff --git a/mayan/apps/checkouts/handlers.py b/mayan/apps/checkouts/handlers.py index 4b5a59e2ad..8fa2813a71 100644 --- a/mayan/apps/checkouts/handlers.py +++ b/mayan/apps/checkouts/handlers.py @@ -9,7 +9,6 @@ def check_new_version_creation(sender, instance, **kwargs): """ Make sure that new version creation is allowed for this document """ - NewVersionBlock = apps.get_model( app_label='checkouts', model_name='NewVersionBlock' ) diff --git a/mayan/apps/checkouts/widgets.py b/mayan/apps/checkouts/widgets.py index 9045f17b9f..063c27de3d 100644 --- a/mayan/apps/checkouts/widgets.py +++ b/mayan/apps/checkouts/widgets.py @@ -14,7 +14,6 @@ class SplitTimeDeltaWidget(forms.widgets.MultiWidget): A Widget that splits a timedelta input into three boxes. """ - def __init__(self, attrs=None): widgets = ( forms.widgets.NumberInput( diff --git a/mayan/apps/common/forms.py b/mayan/apps/common/forms.py index 84e8eadefe..beb31aa41c 100644 --- a/mayan/apps/common/forms.py +++ b/mayan/apps/common/forms.py @@ -195,7 +195,6 @@ class UserForm(forms.ModelForm): """ Form used to edit an user's mininal fields by the user himself """ - class Meta: fields = ('username', 'first_name', 'last_name', 'email') model = get_user_model() @@ -205,7 +204,6 @@ class UserForm_view(DetailForm): """ Form used to display an user's public details """ - class Meta: fields = ( 'username', 'first_name', 'last_name', 'email', 'last_login', diff --git a/mayan/apps/common/mixins.py b/mayan/apps/common/mixins.py index 2db8cd372c..307fa38089 100644 --- a/mayan/apps/common/mixins.py +++ b/mayan/apps/common/mixins.py @@ -48,7 +48,6 @@ class ExtraContextMixin(object): """ Mixin that allows views to pass extra context to the template """ - extra_context = {} def get_extra_context(self): @@ -64,7 +63,6 @@ class FormExtraKwargsMixin(object): """ Mixin that allows a view to pass extra keyword arguments to forms """ - form_extra_kwargs = {} def get_form_extra_kwargs(self): @@ -123,7 +121,6 @@ class MultipleObjectMixin(object): """ Mixin that allows a view to work on a single or multiple objects """ - model = None object_permission = None pk_list_key = 'id_list' @@ -184,7 +181,6 @@ class ObjectActionMixin(object): """ Mixin that performs an user action to a queryset """ - success_message = 'Operation performed on %(count)d object' success_message_plural = 'Operation performed on %(count)d objects' diff --git a/mayan/apps/common/templatetags/common_tags.py b/mayan/apps/common/templatetags/common_tags.py index 063179656b..b5cbbb249e 100644 --- a/mayan/apps/common/templatetags/common_tags.py +++ b/mayan/apps/common/templatetags/common_tags.py @@ -83,7 +83,6 @@ def render_subtemplate(context, template_name, template_context): Renders the specified template with the mixed parent and subtemplate contexts """ - new_context = Context(context.flatten()) new_context.update(Context(template_context)) return get_template(template_name).render(new_context.flatten()) diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py index 1fe2e136fd..f81f9b4862 100644 --- a/mayan/apps/common/views.py +++ b/mayan/apps/common/views.py @@ -312,7 +312,6 @@ def multi_object_action_view(request): Proxy view called first when using a multi object action, which then redirects to the appropiate specialized view """ - next = request.POST.get( 'next', request.GET.get( 'next', request.META.get( diff --git a/mayan/apps/converter/managers.py b/mayan/apps/converter/managers.py index e711dfce9f..6050a56cd9 100644 --- a/mayan/apps/converter/managers.py +++ b/mayan/apps/converter/managers.py @@ -65,7 +65,6 @@ class TransformationManager(models.Manager): as_classes == True returns the transformation classes from .classes ready to be feed to the converter class """ - content_type = ContentType.objects.get_for_model(obj) transformations = self.filter( diff --git a/mayan/apps/converter/validators.py b/mayan/apps/converter/validators.py index 20f8a2ac19..a851bf4821 100644 --- a/mayan/apps/converter/validators.py +++ b/mayan/apps/converter/validators.py @@ -12,7 +12,6 @@ class YAMLValidator(object): """ Validates that the input is YAML compliant. """ - def __call__(self, value): value = value.strip() try: diff --git a/mayan/apps/document_indexing/api_views.py b/mayan/apps/document_indexing/api_views.py index c821223df4..a9592e4648 100644 --- a/mayan/apps/document_indexing/api_views.py +++ b/mayan/apps/document_indexing/api_views.py @@ -56,7 +56,6 @@ class APIIndexNodeInstanceDocumentListView(generics.ListAPIView): Returns a list of all the documents contained by a particular index node instance. """ - filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = {'GET': (permission_document_view,)} serializer_class = DocumentSerializer @@ -105,7 +104,6 @@ class APIDocumentIndexListView(generics.ListAPIView): """ Returns a list of all the indexes to which a document belongs. """ - filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = {'GET': (permission_document_indexing_view,)} serializer_class = IndexInstanceNodeSerializer diff --git a/mayan/apps/document_indexing/views.py b/mayan/apps/document_indexing/views.py index 2130f0bac7..9d11e986a1 100644 --- a/mayan/apps/document_indexing/views.py +++ b/mayan/apps/document_indexing/views.py @@ -291,7 +291,6 @@ class DocumentIndexNodeListView(SingleObjectListView): """ Show a list of indexes where the current document can be found """ - object_permission = permission_document_indexing_view object_permission_related = 'index' diff --git a/mayan/apps/document_indexing/widgets.py b/mayan/apps/document_indexing/widgets.py index 1eb989ba3a..faf4d5c916 100644 --- a/mayan/apps/document_indexing/widgets.py +++ b/mayan/apps/document_indexing/widgets.py @@ -10,7 +10,6 @@ def get_instance_link(index_instance_node): """ Return an HTML anchor to an index node instance """ - return mark_safe( '{text}'.format( url=index_instance_node.get_absolute_url(), @@ -45,7 +44,6 @@ def node_level(node): """ Render an indented tree like output for a specific node """ - return mark_safe( ''.join( [ diff --git a/mayan/apps/document_parsing/parsers.py b/mayan/apps/document_parsing/parsers.py index 982dd2f105..ed693f66b3 100644 --- a/mayan/apps/document_parsing/parsers.py +++ b/mayan/apps/document_parsing/parsers.py @@ -19,7 +19,6 @@ class Parser(object): """ Parser base class """ - _registry = {} @classmethod @@ -110,7 +109,6 @@ class PopplerParser(Parser): """ PDF parser using the pdftotext execute from the poppler package """ - def __init__(self): self.pdftotext_path = setting_pdftotext_path.value if not os.path.exists(self.pdftotext_path): diff --git a/mayan/apps/document_signatures/models.py b/mayan/apps/document_signatures/models.py index a2c10e8ccb..65dd50e447 100644 --- a/mayan/apps/document_signatures/models.py +++ b/mayan/apps/document_signatures/models.py @@ -35,7 +35,6 @@ class SignatureBaseModel(models.Model): it will generate a unique signature ID. No two signature IDs are the same, even when using the same key. """ - document_version = models.ForeignKey( DocumentVersion, editable=False, on_delete=models.CASCADE, related_name='signatures', verbose_name=_('Document version') diff --git a/mayan/apps/document_states/api_views.py b/mayan/apps/document_states/api_views.py index c840d1865f..9466b88e23 100644 --- a/mayan/apps/document_states/api_views.py +++ b/mayan/apps/document_states/api_views.py @@ -62,7 +62,6 @@ class APIWorkflowDocumentTypeList(generics.ListCreateAPIView): """ This view returns a list of document types that belong to a workflow. """ - return self.get_workflow().document_types.all() def get_serializer(self, *args, **kwargs): @@ -96,7 +95,6 @@ class APIWorkflowDocumentTypeList(generics.ListCreateAPIView): Retrieve the parent workflow of the workflow document type. Perform custom permission and access check. """ - if self.request.method == 'GET': permission_required = permission_workflow_view else: @@ -488,7 +486,6 @@ class APIWorkflowInstanceLogEntryListView(generics.ListCreateAPIView): Failing that, check for ACLs for any of the workflow's transitions. Failing that, then raise PermissionDenied """ - AccessControlList.objects.check_access( permissions=permission_workflow_view, user=self.request.user, obj=document diff --git a/mayan/apps/documents/api_views.py b/mayan/apps/documents/api_views.py index f7b865b72b..efb387b18f 100644 --- a/mayan/apps/documents/api_views.py +++ b/mayan/apps/documents/api_views.py @@ -381,7 +381,6 @@ class APIDocumentTypeDocumentListView(generics.ListAPIView): """ Returns a list of all the documents of a particular document type. """ - filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = {'GET': (permission_document_view,)} serializer_class = DocumentSerializer diff --git a/mayan/apps/documents/forms.py b/mayan/apps/documents/forms.py index 9d71b8d881..9e8c77097e 100644 --- a/mayan/apps/documents/forms.py +++ b/mayan/apps/documents/forms.py @@ -166,7 +166,6 @@ class DocumentTypeSelectForm(forms.Form): Form to select the document type of a document to be created, used as form #1 in the document creation wizard """ - def __init__(self, *args, **kwargs): user = kwargs.pop('user', None) logger.debug('user: %s', user) diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index 06b5a7a316..400284e839 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -154,7 +154,6 @@ class Document(models.Model): generated for each document. No two documents can ever have the same UUID. This ID is generated automatically. """ - uuid = models.UUIDField(default=uuid.uuid4, editable=False) document_type = models.ForeignKey( DocumentType, on_delete=models.CASCADE, related_name='documents', diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index a7f7a09050..6ac64d303e 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -119,7 +119,6 @@ class DocumentTestCase(BaseTestCase): Test document type trashing policies. Documents are moved to the trash, x amount of time after being uploaded """ - self.document_type.trash_time_period = 1 # 'seconds' is not a choice via the model, used here for convenience self.document_type.trash_time_unit = 'seconds' @@ -142,7 +141,6 @@ class DocumentTestCase(BaseTestCase): Test document type deletion policies. Documents are deleted from the trash, x amount of time after being trashed """ - self.document_type.delete_time_period = 1 # 'seconds' is not a choice via the model, used here for convenience self.document_type.delete_time_unit = 'seconds' diff --git a/mayan/apps/dynamic_search/tests/test_models.py b/mayan/apps/dynamic_search/tests/test_models.py index b75b998153..c45ae9a3ba 100644 --- a/mayan/apps/dynamic_search/tests/test_models.py +++ b/mayan/apps/dynamic_search/tests/test_models.py @@ -30,7 +30,6 @@ class DocumentSearchTestCase(BaseTestCase): Test that simple search works after related_name changes to document versions and document version pages """ - queryset, elapsed_time = document_search.search( {'q': 'Mayan'}, user=self.admin_user ) diff --git a/mayan/apps/dynamic_search/tests/test_views.py b/mayan/apps/dynamic_search/tests/test_views.py index d63c0816af..f56473d94e 100644 --- a/mayan/apps/dynamic_search/tests/test_views.py +++ b/mayan/apps/dynamic_search/tests/test_views.py @@ -13,7 +13,6 @@ class Issue46TestCase(GenericViewTestCase): """ Functional tests to make sure issue 46 is fixed """ - def setUp(self): super(Issue46TestCase, self).setUp() self.login_admin_user() diff --git a/mayan/apps/metadata/api_views.py b/mayan/apps/metadata/api_views.py index 0df957d0ed..89a6a2923e 100644 --- a/mayan/apps/metadata/api_views.py +++ b/mayan/apps/metadata/api_views.py @@ -28,13 +28,10 @@ from .serializers import ( class APIDocumentMetadataListView(generics.ListCreateAPIView): - def get(self, *args, **kwargs): - """ - Returns a list of selected document's metadata types and values. - """ - - return super(APIDocumentMetadataListView, self).get(*args, **kwargs) - + """ + get: Returns a list of selected document's metadata types and values. + post: Add an existing metadata type and value to the selected document. + """ def get_document(self): if self.request.method == 'GET': permission_required = permission_metadata_document_view @@ -81,31 +78,16 @@ class APIDocumentMetadataListView(generics.ListCreateAPIView): return context - def post(self, *args, **kwargs): - """ - Add an existing metadata type and value to the selected document. - """ - - return super(APIDocumentMetadataListView, self).post(*args, **kwargs) - class APIDocumentMetadataView(generics.RetrieveUpdateDestroyAPIView): + """ + delete: Remove this metadata entry from the selected document. + get: Return the details of the selected document metadata type and value. + patch: Edit the selected document metadata type and value. + put: Edit the selected document metadata type and value. + """ lookup_url_kwarg = 'metadata_pk' - def delete(self, *args, **kwargs): - """ - Remove this metadata entry from the selected document. - """ - - return super(APIDocumentMetadataView, self).delete(*args, **kwargs) - - def get(self, *args, **kwargs): - """ - Return the details of the selected document metadata type and value. - """ - - return super(APIDocumentMetadataView, self).get(*args, **kwargs) - def get_document(self): if self.request.method == 'GET': permission_required = permission_metadata_document_view @@ -142,22 +124,12 @@ class APIDocumentMetadataView(generics.RetrieveUpdateDestroyAPIView): else: return DocumentMetadataSerializer - def patch(self, *args, **kwargs): - """ - Edit the selected document metadata type and value. - """ - - return super(APIDocumentMetadataView, self).patch(*args, **kwargs) - - def put(self, *args, **kwargs): - """ - Edit the selected document metadata type and value. - """ - - return super(APIDocumentMetadataView, self).put(*args, **kwargs) - class APIMetadataTypeListView(generics.ListCreateAPIView): + """ + get: Returns a list of all the metadata types. + post: Create a new metadata type. + """ filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = {'GET': (permission_metadata_type_view,)} mayan_view_permissions = {'POST': (permission_metadata_type_create,)} @@ -165,22 +137,14 @@ class APIMetadataTypeListView(generics.ListCreateAPIView): queryset = MetadataType.objects.all() serializer_class = MetadataTypeSerializer - def get(self, *args, **kwargs): - """ - Returns a list of all the metadata types. - """ - - return super(APIMetadataTypeListView, self).get(*args, **kwargs) - - def post(self, *args, **kwargs): - """ - Create a new metadata type. - """ - - return super(APIMetadataTypeListView, self).post(*args, **kwargs) - class APIMetadataTypeView(generics.RetrieveUpdateDestroyAPIView): + """ + delete: Delete the selected metadata type. + get: Return the details of the selected metadata type. + patch: Edit the selected metadata type. + put: Edit the selected metadata type. + """ lookup_url_kwarg = 'metadata_type_pk' mayan_object_permissions = { 'GET': (permission_metadata_type_view,), @@ -192,47 +156,14 @@ class APIMetadataTypeView(generics.RetrieveUpdateDestroyAPIView): queryset = MetadataType.objects.all() serializer_class = MetadataTypeSerializer - def delete(self, *args, **kwargs): - """ - Delete the selected metadata type. - """ - - return super(APIMetadataTypeView, self).delete(*args, **kwargs) - - def get(self, *args, **kwargs): - """ - Return the details of the selected metadata type. - """ - - return super(APIMetadataTypeView, self).get(*args, **kwargs) - - def patch(self, *args, **kwargs): - """ - Edit the selected metadata type. - """ - - return super(APIMetadataTypeView, self).patch(*args, **kwargs) - - def put(self, *args, **kwargs): - """ - Edit the selected metadata type. - """ - - return super(APIMetadataTypeView, self).put(*args, **kwargs) - class APIDocumentTypeMetadataTypeListView(generics.ListCreateAPIView): + """ + get: Returns a list of selected document type's metadata types. + post: Add a metadata type to the selected document type. + """ lookup_url_kwarg = 'metadata_type_pk' - def get(self, *args, **kwargs): - """ - Returns a list of selected document type's metadata types. - """ - - return super( - APIDocumentTypeMetadataTypeListView, self - ).get(*args, **kwargs) - def get_document_type(self): if self.request.method == 'GET': permission_required = permission_document_type_view @@ -279,38 +210,17 @@ class APIDocumentTypeMetadataTypeListView(generics.ListCreateAPIView): return context - def post(self, *args, **kwargs): - """ - Add a metadata type to the selected document type. - """ - - return super( - APIDocumentTypeMetadataTypeListView, self - ).post(*args, **kwargs) - class APIDocumentTypeMetadataTypeView(generics.RetrieveUpdateDestroyAPIView): + """ + delete: Remove a metadata type from a document type. + get: Retrieve the details of a document type metadata type. + patch: Edit the selected document type metadata type. + put: Edit the selected document type metadata type. + """ lookup_url_kwarg = 'metadata_type_pk' serializer_class = DocumentTypeMetadataTypeSerializer - def delete(self, *args, **kwargs): - """ - Remove a metadata type from a document type. - """ - - return super( - APIDocumentTypeMetadataTypeView, self - ).delete(*args, **kwargs) - - def get(self, *args, **kwargs): - """ - Retrieve the details of a document type metadata type. - """ - - return super( - APIDocumentTypeMetadataTypeView, self - ).get(*args, **kwargs) - def get_document_type(self): if self.request.method == 'GET': permission_required = permission_document_type_view @@ -342,21 +252,3 @@ class APIDocumentTypeMetadataTypeView(generics.RetrieveUpdateDestroyAPIView): return DocumentTypeMetadataTypeSerializer else: return WritableDocumentTypeMetadataTypeSerializer - - def patch(self, *args, **kwargs): - """ - Edit the selected document type metadata type. - """ - - return super( - APIDocumentTypeMetadataTypeView, self - ).patch(*args, **kwargs) - - def put(self, *args, **kwargs): - """ - Edit the selected document type metadata type. - """ - - return super( - APIDocumentTypeMetadataTypeView, self - ).put(*args, **kwargs) diff --git a/mayan/apps/metadata/models.py b/mayan/apps/metadata/models.py index 2e2f774c01..d7097bef4e 100644 --- a/mayan/apps/metadata/models.py +++ b/mayan/apps/metadata/models.py @@ -35,7 +35,6 @@ class MetadataType(models.Model): """ Define a type of metadata """ - name = models.CharField( max_length=48, help_text=_( @@ -149,7 +148,6 @@ class DocumentMetadata(models.Model): Link a document to a specific instance of a metadata type with it's current value """ - document = models.ForeignKey( Document, on_delete=models.CASCADE, related_name='metadata', verbose_name=_('Document') diff --git a/mayan/apps/metadata/tests/test_models.py b/mayan/apps/metadata/tests/test_models.py index 40339521ff..3be8d32653 100644 --- a/mayan/apps/metadata/tests/test_models.py +++ b/mayan/apps/metadata/tests/test_models.py @@ -100,7 +100,6 @@ class MetadataTestCase(MetadataTypeMixin, BaseTestCase): Checks for GitLab issue #250 Empty optional lookup metadata trigger validation error """ - self.metadata_type.lookup = TEST_LOOKUP_TEMPLATE self.metadata_type.save() diff --git a/mayan/apps/motd/api_views.py b/mayan/apps/motd/api_views.py index 4799ab357d..a20d1f60d8 100644 --- a/mayan/apps/motd/api_views.py +++ b/mayan/apps/motd/api_views.py @@ -14,6 +14,10 @@ from .serializers import MessageSerializer class APIMessageListView(generics.ListCreateAPIView): + """ + get: Returns a list of all the messages. + post: Create a new message. + """ filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = {'GET': (permission_message_view,)} mayan_view_permissions = {'POST': (permission_message_create,)} @@ -21,22 +25,14 @@ class APIMessageListView(generics.ListCreateAPIView): queryset = Message.objects.all() serializer_class = MessageSerializer - def get(self, *args, **kwargs): - """ - Returns a list of all the messages. - """ - - return super(APIMessageListView, self).get(*args, **kwargs) - - def post(self, *args, **kwargs): - """ - Create a new message. - """ - - return super(APIMessageListView, self).post(*args, **kwargs) - class APIMessageView(generics.RetrieveUpdateDestroyAPIView): + """ + delete: Delete the selected message. + get: Return the details of the selected message. + patch: Edit the selected message. + put: Edit the selected message. + """ filter_backends = (MayanObjectPermissionsFilter,) mayan_object_permissions = { 'DELETE': (permission_message_delete,), @@ -46,31 +42,3 @@ class APIMessageView(generics.RetrieveUpdateDestroyAPIView): } queryset = Message.objects.all() serializer_class = MessageSerializer - - def delete(self, *args, **kwargs): - """ - Delete the selected message. - """ - - return super(APIMessageView, self).delete(*args, **kwargs) - - def get(self, *args, **kwargs): - """ - Return the details of the selected message. - """ - - return super(APIMessageView, self).get(*args, **kwargs) - - def patch(self, *args, **kwargs): - """ - Edit the selected message. - """ - - return super(APIMessageView, self).patch(*args, **kwargs) - - def put(self, *args, **kwargs): - """ - Edit the selected message. - """ - - return super(APIMessageView, self).put(*args, **kwargs) diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index 8d13f0a599..944587b9ce 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -100,7 +100,6 @@ class Menu(object): """ Associate a link to a model, a view inside this menu """ - try: for source in sources: self._map_links_to_source( @@ -237,7 +236,6 @@ class Menu(object): Allow unbinding links from sources, used to allow 3rd party apps to change the link binding of core apps """ - try: for source in sources: self._map_links_to_source( diff --git a/mayan/apps/ocr/tests/test_api.py b/mayan/apps/ocr/tests/test_api.py index b8690c8e21..c91e92a765 100644 --- a/mayan/apps/ocr/tests/test_api.py +++ b/mayan/apps/ocr/tests/test_api.py @@ -19,7 +19,6 @@ class OCRAPITestCase(BaseAPITestCase): """ Test the OCR app API endpoints """ - def setUp(self): super(OCRAPITestCase, self).setUp() self.login_user() diff --git a/mayan/apps/rest_api/tests/base.py b/mayan/apps/rest_api/tests/base.py index 5f7f90352f..8fbe927250 100644 --- a/mayan/apps/rest_api/tests/base.py +++ b/mayan/apps/rest_api/tests/base.py @@ -18,7 +18,6 @@ class BaseAPITestCase(UserMixin, APITestCase): """ API test case class that invalidates permissions and smart settings """ - def setUp(self): super(BaseAPITestCase, self).setUp() Namespace.invalidate_cache_all() diff --git a/mayan/apps/sources/api_views.py b/mayan/apps/sources/api_views.py index 5e5e146564..7335ecb9c0 100644 --- a/mayan/apps/sources/api_views.py +++ b/mayan/apps/sources/api_views.py @@ -33,7 +33,6 @@ class APIStagingSourceListView(generics.ListAPIView): """ get: Returns a list of all the staging folders and the files they contain. """ - serializer_class = StagingFolderSerializer queryset = StagingFolderSource.objects.all() diff --git a/mayan/apps/sources/tests/test_views.py b/mayan/apps/sources/tests/test_views.py index 1ed3953bea..1f99200a92 100644 --- a/mayan/apps/sources/tests/test_views.py +++ b/mayan/apps/sources/tests/test_views.py @@ -79,7 +79,6 @@ class DocumentUploadTestCase(GenericDocumentViewTestCase): Test uploading of documents by granting the document create permssion for the document type to the user """ - self.login_user() # Create an access control entry giving the role the document @@ -226,7 +225,6 @@ class NewDocumentVersionViewTestCase(GenericDocumentViewTestCase): - Link to upload version view should not resolve - Upload version view should reject request """ - self.login_admin_user() NewVersionBlock.objects.block(self.document) diff --git a/mayan/apps/sources/wizards.py b/mayan/apps/sources/wizards.py index 7da8359991..9bcc9fe1d8 100644 --- a/mayan/apps/sources/wizards.py +++ b/mayan/apps/sources/wizards.py @@ -22,7 +22,6 @@ def has_metadata_types(wizard): """ Skip the 2nd step if document type has no associated metadata """ - cleaned_data = wizard.get_cleaned_data_for_step(STEP_DOCUMENT_TYPE) or {} document_type = cleaned_data.get('document_type') diff --git a/mayan/conf.py b/mayan/conf.py index 5ddcfc8185..1184d8393b 100644 --- a/mayan/conf.py +++ b/mayan/conf.py @@ -2,7 +2,6 @@ This module should be called settings.py but is named conf.py to avoid a class with the mayan/settings/* module """ - from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ diff --git a/mayan/wsgi.py b/mayan/wsgi.py index 17bf3be7c5..72336b37a3 100644 --- a/mayan/wsgi.py +++ b/mayan/wsgi.py @@ -6,7 +6,6 @@ It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ - import os from django.core.wsgi import get_wsgi_application