pgadmin4/web/pgadmin/utils/ajax.py
Ronan Dunklau 9e0b011ec8 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.
2015-06-29 12:23:11 +05:30

22 lines
677 B
Python

##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2015, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""Utility functions for dealing with AJAX."""
from flask import jsonify
import json
def make_json_response(success=True, **kwargs):
"""Create a HTML response document describing the results of a request and
containing the data."""
response = kwargs.copy()
response.setdefault('result', {})
response.setdefault('data', {})
return jsonify(response)