Allow default binary paths to be set in the config for each database driver.

pull/3/head
Dave Page 2016-11-23 12:44:13 +00:00
parent 961f946a76
commit 08396ce861
2 changed files with 18 additions and 1 deletions

View File

@ -263,6 +263,21 @@ STORAGE_DIR = os.path.join(
'storage' 'storage'
) )
##########################################################################
# Default locations for binary utilities (pg_dump, pg_restore etc)
#
# These are intentionally left empty in the main config file, but are
# expected to be overridden by packagers in config_distro.py.
#
# A default location can be specified for each database driver ID, in
# a dictionary. A relative (to the working directory for the package)
# location may be specified, or absolute.
##########################################################################
DEFAULT_BINARY_PATHS = {
"pg": "",
"ppas": ""
}
########################################################################## ##########################################################################
# Test settings - used primarily by the regression suite, not for users # Test settings - used primarily by the regression suite, not for users
########################################################################## ##########################################################################

View File

@ -13,6 +13,7 @@ from flask import render_template
from flask_babel import gettext as _ from flask_babel import gettext as _
from pgadmin.utils.preferences import Preferences from pgadmin.utils.preferences import Preferences
import config
class ServerType(object): class ServerType(object):
""" """
@ -48,11 +49,12 @@ class ServerType(object):
for key in cls.registry: for key in cls.registry:
st = cls.registry[key] st = cls.registry[key]
default_path = config.DEFAULT_BINARY_PATHS[st.stype] or ""
st.utility_path = paths.register( st.utility_path = paths.register(
'bin_paths', st.stype + '_bin_dir', 'bin_paths', st.stype + '_bin_dir',
_("{0} Binary Path").format(st.desc), _("{0} Binary Path").format(st.desc),
'text', "", category_label=_('Binary paths'), 'text', default_path, category_label=_('Binary paths'),
help_str=_( help_str=_(
"Path to the directory containing the {0} utility programs (pg_dump, pg_restore etc).".format( "Path to the directory containing the {0} utility programs (pg_dump, pg_restore etc).".format(
st.desc st.desc