Prefer arg to config

This commit is contained in:
INADA Naoki
2015-06-01 13:22:39 +09:00
parent 818edd8354
commit ddc9a86cb8

View File

@@ -591,11 +591,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)