Commit 7e9a6a05 authored by Michal Čihař's avatar Michal Čihař

Remove indent parameter from API

It's not really needed and it's not possible to implement it using
JsonResponse and Django < 1.9.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 633edf03
......@@ -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
......
......@@ -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
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment