Create a HTML response document describing the results of a request and containing the data.
(
success=1, errormsg='', info='', result=None, data=None, status=200
)
| 64 | |
| 65 | |
| 66 | def make_json_response( |
| 67 | success=1, errormsg='', info='', result=None, data=None, status=200 |
| 68 | ): |
| 69 | """Create a HTML response document describing the results of a request and |
| 70 | containing the data.""" |
| 71 | doc = dict() |
| 72 | doc['success'] = success |
| 73 | doc['errormsg'] = errormsg |
| 74 | doc['info'] = info |
| 75 | doc['result'] = result |
| 76 | doc['data'] = data |
| 77 | |
| 78 | return Response( |
| 79 | response=json.dumps(doc, cls=DataTypeJSONEncoder, |
| 80 | separators=(',', ':')), |
| 81 | status=status, |
| 82 | mimetype="application/json", |
| 83 | headers=get_no_cache_header() |
| 84 | ) |
| 85 | |
| 86 | |
| 87 | def make_response(response=None, status=200): |