summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-29 23:33:37 -0300
committerdrebs <drebs@riseup.net>2017-09-30 00:47:15 -0300
commit8aa665df40a1535012e8dcf990ae21c473631948 (patch)
tree0cafcc34786919ffc3fb0720fc944b82b2db4cef /src
parentc2395e4567d40252bf2a8e7cbe46ce45cc56d7ea (diff)
[bug] fix argument passing in blobs queries
Diffstat (limited to 'src')
-rw-r--r--src/leap/soledad/client/_db/blobs.py11
-rw-r--r--src/leap/soledad/server/_blobs.py5
2 files changed, 9 insertions, 7 deletions
diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py
index a22c3f0f..60c369b2 100644
--- a/src/leap/soledad/client/_db/blobs.py
+++ b/src/leap/soledad/client/_db/blobs.py
@@ -259,11 +259,12 @@ class BlobManager(object):
"""
uri = urljoin(self.remote, self.user + '/')
params = {'namespace': namespace} if namespace else {}
- params.update({
- 'order_by': order_by,
- 'filter_flag': filter_flag,
- 'only_count': only_count,
- })
+ if order_by:
+ params['order_by'] = order_by
+ if filter_flag:
+ params['filter_flag'] = filter_flag
+ if only_count:
+ params['only_count'] = only_count
response = yield self._client.get(uri, params=params)
check_http_status(response.code)
defer.returnValue((yield response.json()))
diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py
index cacfe38d..427c63ca 100644
--- a/src/leap/soledad/server/_blobs.py
+++ b/src/leap/soledad/server/_blobs.py
@@ -258,7 +258,7 @@ class BlobsResource(resource.Resource):
def render_GET(self, request):
logger.info("http get: %s" % request.path)
user, blob_id, namespace = self._validate(request)
- if not blob_id and request.args.get('only_count', False):
+ if not blob_id and request.args.get('only_count', [False])[0]:
return self._handler.count(user, request, namespace)
elif not blob_id:
order = request.args.get('order_by', [None])[0]
@@ -266,7 +266,8 @@ class BlobsResource(resource.Resource):
return self._handler.list_blobs(user, request, namespace,
order_by=order,
filter_flag=filter_flag)
- if 'only_flags' in request.args:
+ only_flags = request.args.get('only_flags', [False])[0]
+ if only_flags:
return self._handler.get_flags(user, blob_id, request, namespace)
self._handler.add_tag_header(user, blob_id, request, namespace)
return self._handler.read_blob(user, blob_id, request, namespace)