changeset aaba6f0115b8 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=aaba6f0115b8
description:
Improve profile edition with empty and similar value
Prevent IndexError when path has been removed.
Clear the db_cache when adding new entry.
Do not remove existing profile when edited with same name than another.
issue7946
review51601002
(grafted from 34d08a26580723722194a3ab1d2207ba33685f1a)
diffstat:
tryton/gui/window/dblogin.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r 2ad6a6c0f692 -r aaba6f0115b8 tryton/gui/window/dblogin.py
--- a/tryton/gui/window/dblogin.py Wed Jan 02 19:01:08 2019 +0100
+++ b/tryton/gui/window/dblogin.py Mon Jan 07 21:55:50 2019 +0100
@@ -192,6 +192,7 @@
column = self.profile_tree.get_column(0)
self.profile_tree.set_cursor(len(model) - 1, column,
start_editing=True)
+ self.db_cache = None
def profile_delete(self, button):
self.clear_entries()
@@ -234,14 +235,18 @@
def edit_profilename(self, editable, event, renderer, path):
newtext = editable.get_text()
model = self.profile_tree.get_model()
- oldname = model[path][0]
+ try:
+ oldname = model[path][0]
+ except IndexError:
+ return
if oldname == newtext == '':
del model[path]
return
elif oldname == newtext or newtext == '':
return
- if newtext in self.profiles.sections():
- del model[path]
+ elif newtext in self.profiles.sections():
+ if not oldname:
+ del model[path]
return
elif oldname in self.profiles.sections():
self.profiles.add_section(newtext)