From c207cf819baef75a9dc830dc30f3eac8eee86cbb Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 16 Jul 2009 12:40:52 +0000 Subject: [PATCH] 2352: 'NoneType' object has no attribute 'get_family_handle_list' svn: r12805 --- src/ReportBase/_CommandLineReport.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ReportBase/_CommandLineReport.py b/src/ReportBase/_CommandLineReport.py index d6b78a0da..2aac4e92a 100644 --- a/src/ReportBase/_CommandLineReport.py +++ b/src/ReportBase/_CommandLineReport.py @@ -79,7 +79,7 @@ def _validate_options(options, dbase): phandle = dbase.get_person_handles()[0] person = dbase.get_person_from_handle(phandle) if not person: - print "Please specify a person" + print "ERROR: Please specify a person" if person: option.set_value(person.get_gramps_id()) @@ -88,13 +88,22 @@ def _validate_options(options, dbase): family = dbase.get_family_from_gramps_id(fid) if not family: person = dbase.get_default_person() - family_list = person.get_family_handle_list() + family_list = [] + family_handle = None + if person: + family_list = person.get_family_handle_list() if family_list: family_handle = family_list[0] else: - family_handle = dbase.get_family_handles()[0] - family = dbase.get_family_from_handle(family_handle) - option.set_value(family.get_gramps_id()) + flist = dbase.get_family_handles() + if flist: + family_handle = flist[0] + if family_handle: + family = dbase.get_family_from_handle(family_handle) + option.set_value(family.get_gramps_id()) + else: + print "ERROR: Please specify a family" + #------------------------------------------------------------------------ #