Skip to content

Commit b612edf

Browse files
author
João Paulo Dubas
committed
Improve response documentation.
1 parent ef55de7 commit b612edf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

fileupload/response.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ def response_mimetype(request):
2020

2121

2222
class JSONResponse(HttpResponse):
23-
"""JSON response class."""
23+
"""JSONResponse -- Extends HTTPResponse to handle JSON format response.
24+
25+
This response can be used in any view that should return a json stream of
26+
data.
27+
28+
Usage:
29+
30+
def a_iew(request):
31+
content = {'key': 'value'}
32+
return JSONResponse(content, mimetype=response_mimetype(request))
33+
34+
"""
2435
def __init__(self, obj='', json_opts=None, mimetype=MIMEJSON, *args, **kwargs):
2536
json_opts = json_opts if isinstance(json_opts, dict) else {}
2637
content = simplejson.dumps(obj, **json_opts)

0 commit comments

Comments
 (0)