Merge pull request #346 from methane/fix/config-priority
Prefer argumet to config
This commit is contained in:
@@ -597,11 +597,13 @@ class Connection(object):
|
|||||||
cfg = configparser.RawConfigParser()
|
cfg = configparser.RawConfigParser()
|
||||||
cfg.read(os.path.expanduser(read_default_file))
|
cfg.read(os.path.expanduser(read_default_file))
|
||||||
|
|
||||||
def _config(key, default):
|
def _config(key, arg):
|
||||||
|
if arg:
|
||||||
|
return arg
|
||||||
try:
|
try:
|
||||||
return cfg.get(read_default_group, key)
|
return cfg.get(read_default_group, key)
|
||||||
except Exception:
|
except Exception:
|
||||||
return default
|
return arg
|
||||||
|
|
||||||
user = _config("user", user)
|
user = _config("user", user)
|
||||||
password = _config("password", password)
|
password = _config("password", password)
|
||||||
|
|||||||
Reference in New Issue
Block a user