From a2faca3f16b3fe9a3955cfcceb2cf3a75bb2517d Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sat, 15 Dec 2001 23:19:54 +0000 Subject: [PATCH] Prevent erroneous place definitions from being added. svn: r620 --- gramps/src/EditPerson.py | 4 ++-- gramps/src/utils.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 93e2ec9a0..9de2ee6f6 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -511,8 +511,8 @@ class EditPerson: utils.redraw_list(self.elist,self.event_list,disp_event) # Remember old combo list input - prev_btext = self.bpcombo.entry.get_text() - prev_dtext = self.dpcombo.entry.get_text() + prev_btext = utils.strip_id(self.bpcombo.entry.get_text()) + prev_dtext = utils.strip_id(self.dpcombo.entry.get_text()) # Update combo lists to add in any new places plist = self.db.getPlaceMap().values() diff --git a/gramps/src/utils.py b/gramps/src/utils.py index 11df15ed7..b555cb1a3 100644 --- a/gramps/src/utils.py +++ b/gramps/src/utils.py @@ -296,6 +296,18 @@ def view_photo(photo): if os.fork() == 0: os.execvp(args[0],args) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def strip_id(text): + index = string.rfind(text,'[') + if (index > 0): + text = text[:index] + text = string.rstrip(text) + return text + #------------------------------------------------------------------------- # #