From 19ea0367951660192f644af4c95ea2d6a9239a7e Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 16 Jul 2009 12:41:09 +0000 Subject: [PATCH] 2352: 'NoneType' object has no attribute 'get_family_handle_list' svn: r12806 --- src/ReportBase/_CommandLineReport.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ReportBase/_CommandLineReport.py b/src/ReportBase/_CommandLineReport.py index 0f2c56577..cbd2e88ea 100644 --- a/src/ReportBase/_CommandLineReport.py +++ b/src/ReportBase/_CommandLineReport.py @@ -80,7 +80,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()) @@ -89,14 +89,20 @@ 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: for family_handle in dbase.iter_family_handles(): break - family = dbase.get_family_from_handle(family_handle) - option.set_value(family.get_gramps_id()) + 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" #------------------------------------------------------------------------ #