From c51d3d8119c9e44b8d2590c7e651a2c859bf6581 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 25 Jan 2007 17:04:37 +0000 Subject: [PATCH] 2007-01-25 Alex Roitman * src/GrampsDb/_GrampsDbBase.py (find_backlink_handles): Correctly iterate only over requested tables; don't mix up the primary and the referenced objects. svn: r7983 --- gramps2/ChangeLog | 5 +++++ gramps2/src/GrampsDb/_GrampsDbBase.py | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 1a08e2a3f..91dba7081 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2007-01-25 Alex Roitman + * src/GrampsDb/_GrampsDbBase.py (find_backlink_handles): Correctly + iterate only over requested tables; don't mix up the primary and + the referenced objects. + 2007-01-25 Brian Matherly * src/plugins/IndivComplete.py: Put children on new lines diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index 0f63e8f62..9755f1b64 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -2152,9 +2152,15 @@ class GrampsDbBase(GrampsDBCallback): } + # Find which tables to iterate over + if (include_classes == None): + the_tables = primary_tables.keys() + else: + the_tables = include_classes + # Now we use the functions and classes defined above to loop through # each of the existing primary object tables - for primary_table_name in primary_tables.keys(): + for primary_table_name in the_tables: cursor = primary_tables[primary_table_name]['cursor_func']() data = cursor.first() @@ -2169,12 +2175,9 @@ class GrampsDbBase(GrampsDBCallback): # Now we need to loop over all object types # that have been requests in the include_classes list - for classname in primary_tables.keys(): - if (include_classes == None) \ - or (classname in include_classes): - - if obj.has_handle_reference(classname,handle): - yield (primary_table_name, found_handle) + for classname in primary_tables.keys(): + if obj.has_handle_reference(classname,handle): + yield (primary_table_name, found_handle) data = cursor.next()