Permalink
Browse files

Single object: Do not pass inline_depth=0 when full is absent

  • Loading branch information...
1 parent 6e40c54 commit b9ba78be86c02e6ef692a571139b15648f0d7ca5 @matthiask committed May 24, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 towel/api.py
View
@@ -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)

0 comments on commit b9ba78b

Please sign in to comment.