2007-10-29 Gary Burton <gary.burton@zen.co.uk>

* src/gen/lib/person.py: reset birth and death indexes after deleting
    an event. Fixes #1327



svn: r9269
This commit is contained in:
Gary Burton 2007-10-29 22:35:52 +00:00
parent ee6bdfdd5e
commit 29b974160f
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2007-10-29 Gary Burton <gary.burton@zen.co.uk>
* src/gen/lib/person.py: reset birth and death indexes after deleting
an event. Fixes #1327
2007-10-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/holidays.xml: removed SDate: use offset instead

View File

@ -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