diff --git a/ChangeLog b/ChangeLog index c58bc1977..88737ea6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-11-21 Don Allingham + * src/Utils.py (probably_alive): use get_primary_event_ref_list() + * src/RelLib/_Person.py: Add get_primary_event_ref_list() + 2006-11-20 Don Allingham * src/Editors/_EditName.py: autocomplete for surnames * src/glade/gramps.glade: set focus properly diff --git a/src/RelLib/_Person.py b/src/RelLib/_Person.py index 8a4ff6141..a77a8865d 100644 --- a/src/RelLib/_Person.py +++ b/src/RelLib/_Person.py @@ -49,6 +49,7 @@ from _EventRef import EventRef from _PersonRef import PersonRef from _MarkerType import MarkerType from _AttributeType import AttributeType +from _EventRoleType import EventRoleType #------------------------------------------------------------------------- # @@ -521,6 +522,18 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, """ return self.event_ref_list + def get_primary_event_ref_list(self): + """ + Returns the list of L{EventRef} objects associated with L{Event} + instances that have been marked as primary events. + + @returns: Returns the list of L{EventRef} objects associated with + the Person instance. + @rtype: list + """ + return [ ref for ref in self.event_ref_list \ + if ref.get_role() == EventRoleType.PRIMARY ] + def set_event_ref_list(self, event_ref_list): """ Sets the Person instance's L{EventRef} list to the passed list. diff --git a/src/Utils.py b/src/Utils.py index 600b75882..420ca2cd6 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -573,9 +573,7 @@ def probably_alive(person,db,current_year=None,limit=0): # Look for Cause Of Death, Burial or Cremation events. # These are fairly good indications that someone's not alive. - for ev_ref in person.event_ref_list: - if ev_ref.get_role() != RelLib.EventRoleType.PRIMARY: - continue + for ev_ref in person.get_primary_event_ref_list(): ev = db.get_event_from_handle(ev_ref.ref) if ev and int(ev.get_type()) in [RelLib.EventType.CAUSE_DEATH, RelLib.EventType.BURIAL,