From 7e9a6a05fe5f55fa9dd68dfa2fef40e901eb786c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= <michal@cihar.com> Date: Wed, 9 Dec 2015 18:24:24 +0100 Subject: [PATCH] Remove indent parameter from API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not really needed and it's not possible to implement it using JsonResponse and Django < 1.9. Signed-off-by: Michal ÄŒihaÅ™ <michal@cihar.com> --- docs/api.rst | 6 +----- weblate/trans/views/api.py | 7 ------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index ddbc610a0..7aaee3cc7 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -78,20 +78,16 @@ Weblate provides various exports to allow you further process the data. .. http:get:: /exports/stats/(string:project)/(string:component)/ - :query integer indent: pretty printed indentation :query string jsonp: JSONP callback function to wrap the data Retrieves statistics for given component in JSON format. Optionally as JSONP when you specify the callback in the ``jsonp`` parameter. - You can get pretty-printed output by appending ``?indent=1`` to the - request. - **Example request**: .. sourcecode:: http - GET /exports/stats/weblate/master/?indent=4 HTTP/1.1 + GET /exports/stats/weblate/master/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript diff --git a/weblate/trans/views/api.py b/weblate/trans/views/api.py index b0652bf8e..6fc515b2a 100644 --- a/weblate/trans/views/api.py +++ b/weblate/trans/views/api.py @@ -300,11 +300,6 @@ def export_stats(request, project, subproject): ''' subprj = get_subproject(request, project, subproject) - try: - indent = int(request.GET['indent']) - except (ValueError, KeyError): - indent = None - jsonp = None if 'jsonp' in request.GET and request.GET['jsonp']: jsonp = request.GET['jsonp'] @@ -335,13 +330,11 @@ def export_stats(request, project, subproject): json.dumps( response, cls=DjangoJSONEncoder, - indent=indent, ) ), content_type='application/javascript' ) return JsonResponse( data=response, - json_dumps_params={'indent': indent}, safe=False ) -- 2.30.9