def __init__(self, import_name, **kwargs): kwargs.setdefault("url_prefix", self.node_path) kwargs.setdefault("static_url_path", '/static') PgAdminModule.__init__(self, "NODE-%s" % self.node_type, import_name, **kwargs) PGChildModule.__init__(self)
def __init__(self, import_name, **kwargs): kwargs.setdefault("url_prefix", self.node_path) kwargs.setdefault("static_url_path", '/static') PgAdminModule.__init__( self, "NODE-%s" % self.node_type, import_name, **kwargs ) PGChildModule.__init__(self)
def get_setting(setting, default=None): """Retrieve a configuration setting for the current user, or return the default value specified by the caller.""" data = Setting.query.filter_by(user_id=current_user.id, setting=setting).first() if not data or data.value is None: return default else: return data.value # Initialise the module blueprint = PgAdminModule(MODULE_NAME, __name__, template_folder='templates', url_prefix='/' + MODULE_NAME) @blueprint.route("/settings.js") @login_required def script(): """Render the required Javascript""" return Response(response=render_template("settings/settings.js"), status=200, mimetype="application/javascript") @blueprint.route("/store", methods=['POST']) @blueprint.route("/store/<setting>/<value>", methods=['GET']) @login_required
# # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2016, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """A blueprint module providing utility functions for the application.""" import datetime from flask import session, current_app from pgadmin.utils import PgAdminModule import pgadmin.utils.driver as driver MODULE_NAME = 'misc' # Initialise the module blueprint = PgAdminModule(MODULE_NAME, __name__, url_prefix='') ########################################################################## # A special URL used to "ping" the server ########################################################################## @blueprint.route("/ping", methods=('get', 'post')) def ping(): """Generate a "PING" response to indicate that the server is alive.""" driver.ping() return "PING"
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2016, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """A blueprint module container for keeping all submodule of type tool.""" from pgadmin.utils import PgAdminModule from pgadmin.utils.ajax import bad_request from flask.ext.babel import gettext MODULE_NAME = 'tools' # Initialise the module blueprint = PgAdminModule(MODULE_NAME, __name__) @blueprint.route("/") def index(): """Calling tools index URL directly is not allowed.""" return bad_request(gettext('This URL can not be requested directly!'))