Skip to content

Instantly share code, notes, and snippets.

@bohde
Created April 7, 2012 17:53
Show Gist options
  • Save bohde/2330859 to your computer and use it in GitHub Desktop.
Save bohde/2330859 to your computer and use it in GitHub Desktop.
Sometimes return data
# Using my `sometimes_return_data` branch
class MyResource(Resource):
def return_full_data(self, request):
truthy = ('true', '1')
return_data = request.META.get('RETURN_DATA', None)
return_data = return_datat or request.GET.get('return_data', None)
return return_data and (return_data.lower() in truthy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment