From e913d93087013c9fdd33aaf6069448f7e9a7c692 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Mon, 8 Apr 2024 10:23:46 +0200 Subject: [PATCH 1/2] Handle not found when creating the updates page Fixes #13216 --- gramps/plugins/webreport/updates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/webreport/updates.py b/gramps/plugins/webreport/updates.py index fde94b10fd3..47731d6ee63 100644 --- a/gramps/plugins/webreport/updates.py +++ b/gramps/plugins/webreport/updates.py @@ -309,13 +309,13 @@ def sort_on_change(handle): fct = self.report.database.get_place_from_handle fct_link = self.place_link elif object_type == Source: - fct = self.report.database.get_place_from_handle + fct = self.report.database.get_source_from_handle fct_link = self.source_link elif object_type == Repository: - fct = self.report.database.get_place_from_handle + fct = self.report.database.get_repository_from_handle fct_link = self.repository_link elif object_type == Media: - fct = self.report.database.get_place_from_handle + fct = self.report.database.get_media_from_handle obj_list = sorted( self.report.obj_dict[object_type], key=sort_on_change, reverse=True ) From 4ecc8549e31351debd4b3f700f3f877eed5ba0c7 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Mon, 8 Apr 2024 16:17:03 +0200 Subject: [PATCH 2/2] Trying to have better error handling. --- gramps/plugins/webreport/updates.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/webreport/updates.py b/gramps/plugins/webreport/updates.py index 47731d6ee63..429101108fb 100644 --- a/gramps/plugins/webreport/updates.py +++ b/gramps/plugins/webreport/updates.py @@ -293,8 +293,12 @@ def list_people_changed(self, object_type): def sort_on_change(handle): """sort records based on the last change time""" - obj = fct(handle) - timestamp = obj.get_change_time() + try: + obj = fct(handle) + timestamp = obj.get_change_time() + except exception: + print("In sort :", handle, " not found for", object_type) + timestamp = 0 return timestamp if object_type == Person: @@ -323,7 +327,11 @@ def sort_on_change(handle): for handle in obj_list: date = obj = None name = "" - obj = fct(handle) + try: + obj = fct(handle) + except exception: + print("Handle not found:", handle, " not found for", object_type) + continue if object_type == Person: name = fct_link(handle) elif object_type == Family: