From cd67c7b13d172cf9f66d5a4979b899c304f7350a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Wed, 3 Oct 2007 21:36:57 +0000 Subject: [PATCH] 2007-10-03 Benny Malengier * src/GrampsDb/_GrampsDbBase.py: copy bookmark list, don't reference * src/GrampsDbUtils/_ReadXML.py: only add bookmarks if not present already, #1187 svn: r9071 --- ChangeLog | 4 ++++ src/GrampsDb/_GrampsDbBase.py | 2 +- src/GrampsDbUtils/_ReadXML.py | 24 ++++++++++++++++-------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d58416c5..04098a5e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-10-03 Benny Malengier + * src/GrampsDb/_GrampsDbBase.py: copy bookmark list, don't reference + * src/GrampsDbUtils/_ReadXML.py: only add bookmarks if not present already, #1187 + 2007-10-03 Benny Malengier * src/Spell.py: add gtkspell bug workaround, see eg issue 1272, 1091, ... diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index d220dff55..150ee79ae 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -97,7 +97,7 @@ class GrampsDbBookmarks: self.bookmarks = list(default) # want a copy (not an alias) def set(self, new_list): - self.bookmarks = new_list + self.bookmarks = list(new_list) def get(self): return self.bookmarks diff --git a/src/GrampsDbUtils/_ReadXML.py b/src/GrampsDbUtils/_ReadXML.py index cc0fc34ac..8ad0df4e6 100644 --- a/src/GrampsDbUtils/_ReadXML.py +++ b/src/GrampsDbUtils/_ReadXML.py @@ -880,28 +880,36 @@ class GrampsParser(UpdateCallback): # Make sure those are filtered out. # Bookmarks are at end, so all handle must exist before we do bookmrks if target == 'person': - if self.db.find_person_from_handle(handle,self.trans) is not None: + if (self.db.find_person_from_handle(handle,self.trans) is not None + and handle not in self.db.bookmarks.get() ): self.db.bookmarks.append(handle) elif target == 'family': - if self.db.find_family_from_handle(handle,self.trans) is not None: + if (self.db.find_family_from_handle(handle,self.trans) is not None + and handle not in self.db.family_bookmarks.get() ): self.db.family_bookmarks.append(handle) elif target == 'event': - if self.db.find_event_from_handle(handle,self.trans) is not None: + if (self.db.find_event_from_handle(handle,self.trans) is not None + and handle not in self.db.event_bookmarks.get() ): self.db.event_bookmarks.append(handle) elif target == 'source': - if self.db.find_source_from_handle(handle,self.trans) is not None: + if (self.db.find_source_from_handle(handle,self.trans) is not None + and handle not in self.db.source_bookmarks.get() ): self.db.source_bookmarks.append(handle) elif target == 'place': - if self.db.find_place_from_handle(handle,self.trans) is not None: + if (self.db.find_place_from_handle(handle,self.trans) is not None + and handle not in self.db.place_bookmarks.get() ): self.db.place_bookmarks.append(handle) elif target == 'media': - if self.db.find_object_from_handle(handle,self.trans) is not None: + if (self.db.find_object_from_handle(handle,self.trans) is not None + and handle not in self.db.media_bookmarks.get() ): self.db.media_bookmarks.append(handle) elif target == 'repository': - if self.db.find_repository_from_handle(handle,self.trans) is not None: + if (self.db.find_repository_from_handle(handle,self.trans) + is not None and handle not in self.db.repo_bookmarks.get()): self.db.repo_bookmarks.append(handle) elif target == 'note': - if self.db.find_note_from_handle(handle, self.trans) is not None: + if (self.db.find_note_from_handle(handle, self.trans) is not None + and handle not in self.db.note_bookmarks.get() ): self.db.note_bookmarks.append(handle) def start_format(self, attrs):