2015-02-15 22:10:53 +00:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# 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."""
|
|
|
|
|
2015-06-29 06:42:27 +00:00
|
|
|
from flask import jsonify
|
2015-02-15 22:10:53 +00:00
|
|
|
import json
|
|
|
|
|
2015-06-29 06:42:27 +00:00
|
|
|
def make_json_response(success=True, **kwargs):
|
2015-02-19 03:06:12 +00:00
|
|
|
"""Create a HTML response document describing the results of a request and
|
2015-02-15 22:10:53 +00:00
|
|
|
containing the data."""
|
2015-06-29 06:42:27 +00:00
|
|
|
response = kwargs.copy()
|
|
|
|
response.setdefault('result', {})
|
|
|
|
response.setdefault('data', {})
|
|
|
|
return jsonify(response)
|