From edc3a001d64d415b8c35a909db5b57339510dcd5 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Tue, 17 Mar 2015 14:02:58 +0000 Subject: [PATCH] 7992: Fix call to get_participant_from_event during batch transaction During a batch transaction the secondary tables are closed. This causes an error when find_backlink_handles is called. Although not ideal, we return an empty string for participants. --- gramps/gen/utils/db.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/gramps/gen/utils/db.py b/gramps/gen/utils/db.py index 59a5ccf1f..9853d8393 100644 --- a/gramps/gen/utils/db.py +++ b/gramps/gen/utils/db.py @@ -260,8 +260,15 @@ def get_participant_from_event(db, event_handle, all_=False): """ participant = "" ellipses = False - result_list = list(db.find_backlink_handles(event_handle, - include_classes=['Person', 'Family'])) + try: + result_list = list(db.find_backlink_handles(event_handle, + include_classes=['Person', 'Family'])) + except: + # during a magic batch transaction find_backlink_handles tries to + # access the reference_map_referenced_map which is closed + # under those circumstances. + return '' + #obtain handles without duplicates people = set([x[1] for x in result_list if x[0] == 'Person']) families = set([x[1] for x in result_list if x[0] == 'Family']) @@ -327,15 +334,7 @@ def navigation_label(db, nav_type, handle): elif nav_type == 'Event': obj = db.get_event_from_handle(handle) if obj: - try: - who = get_participant_from_event(db, handle) - except: - # get_participants_from_event fails when called during a magic - # batch transaction because find_backlink_handles tries to - # access the reference_map_referenced_map which doesn't exist - # under those circumstances. Since setting the navigation_label - # is inessential, just accept this and go on. - who = '' + who = get_participant_from_event(db, handle) desc = obj.get_description() label = obj.get_type() if desc: