1
0
mirror of https://github.com/etesync/server synced 2024-11-26 02:38:15 +00:00

Rename prefer_inline to inline.

This commit is contained in:
Tom Hacohen 2020-04-15 16:47:31 +03:00
parent 6711cfcf49
commit 2e018dfe76
2 changed files with 6 additions and 6 deletions

View File

@ -62,8 +62,8 @@ class CollectionContentField(BinaryBase64Field):
class ChunksField(serializers.RelatedField): class ChunksField(serializers.RelatedField):
def to_representation(self, obj): def to_representation(self, obj):
prefer_inline = self.context.get('prefer_inline', False) inline = self.context.get('inline', False)
if prefer_inline: if inline:
with open(obj.chunkFile.path, 'rb') as f: with open(obj.chunkFile.path, 'rb') as f:
return (obj.uid, b64encode(f.read())) return (obj.uid, b64encode(f.read()))
else: else:

View File

@ -67,8 +67,8 @@ class CollectionViewSet(BaseViewSet):
def get_serializer_context(self): def get_serializer_context(self):
context = super().get_serializer_context() context = super().get_serializer_context()
prefer_inline = self.request.method == 'GET' and 'prefer_inline' in self.request.query_params inline = self.request.method == 'GET' and 'inline' in self.request.query_params
context.update({'request': self.request, 'prefer_inline': prefer_inline}) context.update({'request': self.request, 'inline': inline})
return context return context
def destroy(self, request, uid=None): def destroy(self, request, uid=None):
@ -118,8 +118,8 @@ class CollectionItemViewSet(BaseViewSet):
def get_serializer_context(self): def get_serializer_context(self):
context = super().get_serializer_context() context = super().get_serializer_context()
prefer_inline = self.request.method == 'GET' and 'prefer_inline' in self.request.query_params inline = self.request.method == 'GET' and 'inline' in self.request.query_params
context.update({'request': self.request, 'prefer_inline': prefer_inline}) context.update({'request': self.request, 'inline': inline})
return context return context
def create(self, request, collection_uid=None): def create(self, request, collection_uid=None):