mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed the letter case of the javascript file names.
Also, JSON data should be returned to the client using an application/json MIME-TYPE using flask's jsonify function.
This commit is contained in:
committed by
Ashesh Vashi
parent
751f8383fa
commit
9e0b011ec8
@@ -9,20 +9,13 @@
|
||||
|
||||
"""Utility functions for dealing with AJAX."""
|
||||
|
||||
from flask import Response
|
||||
from flask import jsonify
|
||||
import json
|
||||
|
||||
def make_json_response(success=1, errormsg='', info='', result={}, data={}):
|
||||
def make_json_response(success=True, **kwargs):
|
||||
"""Create a HTML response document describing the results of a request and
|
||||
containing the data."""
|
||||
doc = { }
|
||||
doc['success'] = success
|
||||
doc['errormsg'] = errormsg
|
||||
doc['info'] = info
|
||||
doc['result'] = result
|
||||
doc['data'] = data
|
||||
|
||||
response = Response(response=json.dumps(doc),
|
||||
status=200,
|
||||
mimetype="text/json")
|
||||
return response
|
||||
response = kwargs.copy()
|
||||
response.setdefault('result', {})
|
||||
response.setdefault('data', {})
|
||||
return jsonify(response)
|
||||
|
||||
Reference in New Issue
Block a user