Use filled login to select profile

The login should not be changed when editing the host or database.

issue7928
review72381002
This commit is contained in:
Cédric Krier committed 2019-01-07 21:57:13 +01:00
1 parent 4a11d8ee19
commit b4ae7cb9ef
1 file changed
+4 -1
+4 -1
View File
@@ -550,6 +550,7 @@ class DBLogin(object):
host = common.get_hostname(netloc)
port = common.get_port(netloc)
database = self.entry_database.get_text().strip()
login = self.entry_login.get_text()
for idx, profile_info in enumerate(self.profile_store):
if not profile_info[1]:
continue
@@ -557,11 +558,13 @@ class DBLogin(object):
try:
profile_host = self.profiles.get(profile, 'host')
profile_db = self.profiles.get(profile, 'database')
profile_login = self.profiles.get(profile, 'username')
except configparser.NoOptionError:
continue
if (host == common.get_hostname(profile_host)
and port == common.get_port(profile_host)
and database == profile_db):
and database == profile_db
and (not login or login == profile_login)):
break
else:
idx = -1