Skip to content

Commit

Permalink
Merge pull request #1698 from SNoiraud/B13216
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed Apr 16, 2024
2 parents c7161b6 + 4ecc854 commit ce8c7e6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gramps/plugins/webreport/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -309,21 +313,25 @@ 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
)
with Html("table", class_="list", id="list") as section:
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:
Expand Down

0 comments on commit ce8c7e6

Please sign in to comment.