Skip to content

Commit

Permalink
Merge remote-tracking branch 'sloppyfocus/add_search_parents'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGrosser committed Mar 13, 2021
2 parents 0e22860 + 5a197f0 commit 15762fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/clusto/services/http.py
Expand Up @@ -192,6 +192,7 @@ def show(self, request, prefetch_attrs=None):
'''
Returns attributes and actions available for this object.
'''
search_parents = bool(request.params.get('search_parents', False))
result = {}
result['object'] = self.url
result['driver'] = self.obj.driver
Expand All @@ -201,7 +202,7 @@ def show(self, request, prefetch_attrs=None):
attrs.append(unclusto(x))
result['attrs'] = attrs
result['contents'] = [unclusto(x, prefetch_attrs) for x in self.obj.contents()]
result['parents'] = [unclusto(x, prefetch_attrs) for x in self.obj.parents()]
result['parents'] = [unclusto(x, prefetch_attrs) for x in self.obj.parents(search_parents=search_parents)]
result['actions'] = [x for x in dir(self) if not x.startswith('_') and callable(getattr(self, x))]

return dumps(request, result)
Expand Down Expand Up @@ -290,7 +291,8 @@ class QueryAPI(object):
def get_entities(self, request):
kwargs = {'attrs': []}
for k, v in request.params.items():
if k in ('format', 'callback'): continue
if k in ('format', 'callback'):
continue
v = loads(request, unquote_plus(v))
kwargs[str(k)] = v

Expand Down Expand Up @@ -435,7 +437,8 @@ def post_action(self, request, match):
obj = clusto.get_by_name(objname)
if obj:
return Response(status=409, body='409 Conflict\nObject already exists\n')
except LookupError: pass
except LookupError:
pass

obj = clusto.driverlist[objtype](objname)

Expand Down

0 comments on commit 15762fd

Please sign in to comment.