Skip to content

Commit

Permalink
Single object: Do not pass inline_depth=0 when full is absent
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed May 24, 2012
1 parent 6e40c54 commit b9ba78b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions towel/api.py
Expand Up @@ -719,12 +719,16 @@ def get(self, request, *args, **kwargs):
if objects.single:
# TODO make inline_depth configurable, or remove the support for
# ``?full=1`` completely and let the developer decide.
return self.api.serialize_instance(objects.single,
inline_depth=1 if request.GET.get('full') else 0)
kw = {}
if request.GET.get('full'):
kw['inline_depth'] = 1
return self.api.serialize_instance(objects.single, **kw)

elif objects.set:
return {
'objects': [self.api.serialize_instance(instance) for instance in objects.set],
}

else:
page = objects.page
list_url = api_reverse(objects.queryset.model, 'list', api_name=self.api.name)
Expand Down

0 comments on commit b9ba78b

Please sign in to comment.