changeset 50c563adaf4a in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=50c563adaf4a
description:
        Use filled login to select profile

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

        issue7928
        review72381002
        (grafted from 315f030e75ff41d00f6a24555472a34c369ab65e)
diffstat:

 tryton/gui/window/dblogin.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r aaba6f0115b8 -r 50c563adaf4a tryton/gui/window/dblogin.py
--- a/tryton/gui/window/dblogin.py      Mon Jan 07 21:55:50 2019 +0100
+++ b/tryton/gui/window/dblogin.py      Mon Jan 07 21:57:13 2019 +0100
@@ -550,6 +550,7 @@
         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 @@
             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

Reply via email to