Backrefmodel will skip missing or inaccessible objects

svn: r15459
This commit is contained in:
Doug Blank
2010-05-23 14:59:04 +00:00
parent 0c10a6c7a5
commit 7c4d945da6

View File

@@ -64,21 +64,29 @@ class BackRefModel(gtk.ListStore):
dtype = ref[0] dtype = ref[0]
if dtype == 'Person': if dtype == 'Person':
p = self.db.get_person_from_handle(ref[1]) p = self.db.get_person_from_handle(ref[1])
if not p:
continue
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
name = name_displayer.display(p) name = name_displayer.display(p)
elif dtype == 'Family': elif dtype == 'Family':
p = self.db.get_family_from_handle(ref[1]) p = self.db.get_family_from_handle(ref[1])
if not p:
continue
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
name = Utils.family_name(p, self.db) name = Utils.family_name(p, self.db)
elif dtype == 'Source': elif dtype == 'Source':
p = self.db.get_source_from_handle(ref[1]) p = self.db.get_source_from_handle(ref[1])
if not p:
continue
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
name = p.get_title() name = p.get_title()
elif dtype == 'Event': elif dtype == 'Event':
p = self.db.get_event_from_handle(ref[1]) p = self.db.get_event_from_handle(ref[1])
if not p:
continue
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
name = p.get_description() name = p.get_description()
@@ -93,16 +101,22 @@ class BackRefModel(gtk.ListStore):
'part2': part} 'part2': part}
elif dtype == 'Place': elif dtype == 'Place':
p = self.db.get_place_from_handle(ref[1]) p = self.db.get_place_from_handle(ref[1])
if not p:
continue
name = p.get_title() name = p.get_title()
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
elif dtype == 'Repository': elif dtype == 'Repository':
p = self.db.get_repository_from_handle(ref[1]) p = self.db.get_repository_from_handle(ref[1])
if not p:
continue
name = p.get_name() name = p.get_name()
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
else: else:
p = self.db.get_object_from_handle(ref[1]) p = self.db.get_object_from_handle(ref[1])
if not p:
continue
name = p.get_description() name = p.get_description()
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle