* src/Utils.py (probably_alive): Add some checks to make current year parameter work.
svn: r4315
This commit is contained in:
parent
b0b84ebb1f
commit
f7a5765a44
@ -4,6 +4,8 @@
|
||||
(HasSourceOf): get handle only once, removed unused code.
|
||||
* src/gramps_main.py: Show label for filter input field.
|
||||
|
||||
* src/Utils.py (probably_alive): Add some checks to make current year parameter work.
|
||||
|
||||
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||
* src/GenericFilter.py: added a current year parameter to probably alive rule.
|
||||
* src/Utils.py: added a current year parameter to probably alive function.
|
||||
|
@ -441,14 +441,28 @@ def create_id():
|
||||
def probably_alive(person,db,current_year=None):
|
||||
"""Returns true if the person may be alive."""
|
||||
if person.death_handle:
|
||||
return False
|
||||
if not current_year:
|
||||
return False
|
||||
else:
|
||||
death = db.get_event_from_handle(person.death_handle)
|
||||
if death.get_date_object().get_start_date() != Date.EMPTY:
|
||||
if death.get_date_object().get_year < current_year:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
# Look for Cause Of Death, Burial or Cremation events.
|
||||
# These are fairly good indications that someone's not alive.
|
||||
for ev_handle in person.event_list:
|
||||
ev = db.get_event_from_handle(ev_handle)
|
||||
if ev and ev.name in ["Cause Of Death", "Burial", "Cremation"]:
|
||||
return False
|
||||
if not current_year:
|
||||
return False
|
||||
if ev.get_date_object().get_start_date() != Date.EMPTY:
|
||||
if ev.get_date_object().get_year < current_year:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
if person.birth_handle:
|
||||
birth = db.get_event_from_handle(person.birth_handle)
|
||||
@ -497,6 +511,8 @@ def not_too_old(date,current_year=None):
|
||||
time_struct = time.localtime(time.time())
|
||||
current_year = time_struct[0]
|
||||
year = date.get_year()
|
||||
if year > current_year:
|
||||
return False
|
||||
return not( year != 0 and current_year - year > 110)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user