mirror of
https://github.com/etesync/server
synced 2024-12-01 13:08:10 +00:00
lint: fix many pylint warnings.
This commit is contained in:
parent
358c59f6d7
commit
0beaaf5bf9
@ -83,7 +83,8 @@ class CollectionItemRevisionSerializer(CollectionItemRevisionBaseSerializer):
|
|||||||
class Meta(CollectionItemRevisionBaseSerializer.Meta):
|
class Meta(CollectionItemRevisionBaseSerializer.Meta):
|
||||||
fields = CollectionItemRevisionBaseSerializer.Meta.fields + ('chunksUrls', )
|
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.
|
# 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"
|
# E.g. chunkBaseUrl: "/media/bla/bla/" or chunkBaseUrl: "https://media.etesync.com/bla/bla"
|
||||||
def get_chunks_urls(self, obj):
|
def get_chunks_urls(self, obj):
|
||||||
@ -108,6 +109,7 @@ class CollectionItemRevisionInlineSerializer(CollectionItemRevisionBaseSerialize
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class CollectionItemSerializer(serializers.ModelSerializer):
|
class CollectionItemSerializer(serializers.ModelSerializer):
|
||||||
content = CollectionItemRevisionSerializer(read_only=True, many=False)
|
content = CollectionItemRevisionSerializer(read_only=True, many=False)
|
||||||
|
|
||||||
|
@ -12,15 +12,10 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth import login, get_user_model
|
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
from django.db.models import Q
|
from django.http import Http404
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
|
||||||
from django.http import HttpResponseBadRequest, HttpResponse, Http404
|
|
||||||
from django.shortcuts import get_object_or_404
|
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 status
|
||||||
from rest_framework import viewsets
|
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 rest_framework.response import Response
|
||||||
|
|
||||||
from . import app_settings, paginators
|
from . import app_settings, paginators
|
||||||
from .models import Collection, CollectionItem, CollectionItemChunk
|
from .models import Collection, CollectionItem
|
||||||
from .serializers import (
|
from .serializers import (
|
||||||
CollectionSerializer,
|
CollectionSerializer,
|
||||||
CollectionItemSerializer,
|
CollectionItemSerializer,
|
||||||
CollectionItemInlineSerializer,
|
CollectionItemInlineSerializer,
|
||||||
CollectionItemRevisionSerializer,
|
CollectionItemRevisionSerializer,
|
||||||
CollectionItemRevisionInlineSerializer,
|
|
||||||
CollectionItemChunkSerializer
|
CollectionItemChunkSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -187,7 +181,8 @@ class CollectionItemChunkViewSet(viewsets.ViewSet):
|
|||||||
serializer = self.serializer_class(data=request.data)
|
serializer = self.serializer_class(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
try:
|
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')
|
serializer.save(item=col_it, order='abc')
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
content = {'code': 'integrity_error'}
|
content = {'code': 'integrity_error'}
|
||||||
|
Loading…
Reference in New Issue
Block a user