From 3c9b800a2f5dfe96de976c110ffeaf35d0355179 Mon Sep 17 00:00:00 2001 From: CameronD73 <56762299+CameronD73@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:58:37 +1000 Subject: [PATCH] Fixes bug #0013431. Tests for current_date being an empty date 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. --- gramps/gen/utils/alive.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gramps/gen/utils/alive.py b/gramps/gen/utils/alive.py index b29cea14e89..f6a37e51dcd 100644 --- a/gramps/gen/utils/alive.py +++ b/gramps/gen/utils/alive.py @@ -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: @@ -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