mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 07:16:52 -06:00
aa150030eb
(lazy loading) using the require.js. This allows us to load the javascript required for any node, only when it was loaded in the browser tree. Also, introduced the mechanism to show/edit/create of any node in a tab panel (wcDocker.Panel).
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
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 Response
|
|
import json
|
|
|
|
def make_json_response(success=1, errormsg='', info='', result=None, data=None, status=200):
|
|
"""Create a HTML response document describing the results of a request and
|
|
containing the data."""
|
|
doc = dict()
|
|
doc['success'] = success
|
|
doc['errormsg'] = errormsg
|
|
doc['info'] = info
|
|
doc['result'] = result
|
|
doc['data'] = data
|
|
|
|
return Response(response=json.dumps(doc),
|
|
status=status,
|
|
mimetype="text/json")
|
|
|
|
def make_response(response=None, status=200):
|
|
"""Create a JSON response handled by the backbone models."""
|
|
return Response(response=json.dumps(response),
|
|
status=status,
|
|
mimetype="text/json")
|