1
0
mirror of https://github.com/etesync/server synced 2024-11-25 18:28:46 +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):
def to_representation(self, obj):
prefer_inline = self.context.get('prefer_inline', False)
if prefer_inline:
inline = self.context.get('inline', False)
if inline:
with open(obj.chunkFile.path, 'rb') as f:
return (obj.uid, b64encode(f.read()))
else:

View File

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