From 0beaaf5bf95fc6b7411d92a10d168b9d68f798db Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 26 Feb 2020 14:21:14 +0200 Subject: [PATCH] lint: fix many pylint warnings. --- django_etesync/serializers.py | 4 +++- django_etesync/views.py | 15 +++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/django_etesync/serializers.py b/django_etesync/serializers.py index de49c98..0e5b355 100644 --- a/django_etesync/serializers.py +++ b/django_etesync/serializers.py @@ -83,7 +83,8 @@ class CollectionItemRevisionSerializer(CollectionItemRevisionBaseSerializer): class Meta(CollectionItemRevisionBaseSerializer.Meta): fields = CollectionItemRevisionBaseSerializer.Meta.fields + ('chunksUrls', ) - # FIXME: currently the user is exposed in the url. We don't want that, and we can probably avoid that but still save it under the user. + # FIXME: currently the user is exposed in the url. We don't want that, and we can probably avoid that but still + # save it under the user. # We would probably be better off just let the user calculate the urls from the uid and a base url for the snapshot. # E.g. chunkBaseUrl: "/media/bla/bla/" or chunkBaseUrl: "https://media.etesync.com/bla/bla" def get_chunks_urls(self, obj): @@ -108,6 +109,7 @@ class CollectionItemRevisionInlineSerializer(CollectionItemRevisionBaseSerialize return ret + class CollectionItemSerializer(serializers.ModelSerializer): content = CollectionItemRevisionSerializer(read_only=True, many=False) diff --git a/django_etesync/views.py b/django_etesync/views.py index 9150db0..2e91261 100644 --- a/django_etesync/views.py +++ b/django_etesync/views.py @@ -12,15 +12,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from django.conf import settings -from django.contrib.auth import login, get_user_model +from django.contrib.auth import get_user_model from django.db import IntegrityError, transaction -from django.db.models import Q -from django.core.exceptions import ObjectDoesNotExist -from django.http import HttpResponseBadRequest, HttpResponse, Http404 +from django.http import Http404 from django.shortcuts import get_object_or_404 -from django.views.decorators.csrf import csrf_exempt -from django.views.decorators.http import require_POST from rest_framework import status from rest_framework import viewsets @@ -29,13 +24,12 @@ from rest_framework.decorators import action as action_decorator from rest_framework.response import Response from . import app_settings, paginators -from .models import Collection, CollectionItem, CollectionItemChunk +from .models import Collection, CollectionItem from .serializers import ( CollectionSerializer, CollectionItemSerializer, CollectionItemInlineSerializer, CollectionItemRevisionSerializer, - CollectionItemRevisionInlineSerializer, CollectionItemChunkSerializer ) @@ -187,7 +181,8 @@ class CollectionItemChunkViewSet(viewsets.ViewSet): serializer = self.serializer_class(data=request.data) if serializer.is_valid(): try: - # FIXME: actually generate the correct order value. Or alternatively have it null at first and only set it when ommitting to a snapshot + # FIXME: actually generate the correct order value. Or alternatively have it null at first and only + # set it when ommitting to a snapshot serializer.save(item=col_it, order='abc') except IntegrityError: content = {'code': 'integrity_error'}