diff --git a/ChangeLog b/ChangeLog index fd701f694..e88102726 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-10-29 Gary Burton + * src/gen/lib/person.py: reset birth and death indexes after deleting + an event. Fixes #1327 + 2007-10-29 Douglas S. Blank * src/plugins/holidays.xml: removed SDate: use offset instead diff --git a/src/gen/lib/person.py b/src/gen/lib/person.py index 3c180e38b..0d8255d00 100644 --- a/src/gen/lib/person.py +++ b/src/gen/lib/person.py @@ -227,6 +227,10 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase, def _remove_handle_references(self, classname, handle_list): if classname == 'Event': + # Keep a copy of the birth and death references + birth_ref = self.get_birth_ref() + death_ref = self.get_death_ref() + new_list = [ref for ref in self.event_ref_list if ref.ref not in handle_list] # If deleting removing the reference to the event @@ -240,6 +244,12 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase, in handle_list): self.death_ref_index = -1 self.event_ref_list = new_list + + # Reset the indexes after deleting the event from even_ref_list + if (self.birth_ref_index != -1): + self.set_birth_ref(birth_ref) + if (self.death_ref_index != -1): + self.set_death_ref(birth_ref) elif classname == 'Person': new_list = [ref for ref in self.person_ref_list if ref.ref not in handle_list] @@ -433,7 +443,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase, """ if event_ref and not isinstance(event_ref, EventRef): raise ValueError("Expecting EventRef instance") - if event_ref == None: + if event_ref is None: self.birth_ref_index = -1 return # check whether we already have this ref in the list @@ -456,7 +466,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase, """ if event_ref and not isinstance(event_ref, EventRef): raise ValueError("Expecting EventRef instance") - if event_ref == None: + if event_ref is None: self.death_ref_index = -1 return # check whether we already have this ref in the list