Skip to content

Commit

Permalink
Fixes bug #0013431. Tests for current_date being an empty date
Browse files Browse the repository at this point in the history
Calling routines assume that Today() can be represented either by None or an empty Date instance. This code allows for the latter assumption.
Also fixes debug code, which confused %s and str.format style formatting.  The style chosen is preferred by pylint.
  • Loading branch information
CameronD73 committed Sep 13, 2024
1 parent 6442fa3 commit 3c9b800
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions gramps/gen/utils/alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ def ancestors_too_old(person, year):
return (None, None, "", None)
self.pset.add(person.handle)
LOG.debug(
"ancestors_too_old('%s', %s)".format(
name_displayer.display(person), year
)
"ancestors_too_old('%s', %s)", name_displayer.display(person), year
)
family_handle = person.get_main_parents_family_handle()
if family_handle:
Expand Down Expand Up @@ -669,15 +667,14 @@ def probably_alive(
birth, death, explain, relative = probably_alive_range(
person, db, max_sib_age_diff, max_age_prob_alive, avg_generation_gap
)
if current_date is None:
if current_date is None or not current_date.is_valid():
current_date = Today()
LOG.debug(
"%s: b.%s, d.%s - %s".format(
" ".join(person.get_primary_name().get_text_data_list()),
birth,
death,
explain,
)
"%s: b.%s, d.%s - %s",
name_displayer.display(person),
birth,
death,
explain,
)
if not birth or not death:
# no evidence, must consider alive
Expand Down

0 comments on commit 3c9b800

Please sign in to comment.