From cf636e380f932d14030f57d9182f124a0514308a Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Mon, 3 Oct 2011 19:33:23 +0000 Subject: [PATCH] 5252: Descendend Report traceback referencing NoneType person -- patch from Matt Keenan (matt.keenan@gmail.com) svn: r18246 --- src/plugins/textreport/DescendReport.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/textreport/DescendReport.py b/src/plugins/textreport/DescendReport.py index 442517019..3663b203d 100644 --- a/src/plugins/textreport/DescendReport.py +++ b/src/plugins/textreport/DescendReport.py @@ -220,16 +220,21 @@ class Printinfo(): self.doc.write_text(_("sp. %(spouse)s") % {'spouse':name}, mark) self.dump_string(spouse, family_handle) self.doc.end_paragraph() + else: + self.doc.start_paragraph("DR-Spouse%d" % min(level, 32)) + self.doc.write_text(_("sp. %(spouse)s") % {'spouse':'Unknown'}) + self.doc.end_paragraph() def print_reference(self, level, person, display_num): #Person and their family have already been printed so #print reference here - mark = ReportUtils.get_person_mark(self.database, person) - self.doc.start_paragraph("DR-Spouse%d" % min(level, 32)) - name = self._name_display.display(person) - self.doc.write_text(_("sp. see %(reference)s : %(spouse)s") % - {'reference':display_num, 'spouse':name}, mark) - self.doc.end_paragraph() + if person: + mark = ReportUtils.get_person_mark(self.database, person) + self.doc.start_paragraph("DR-Spouse%d" % min(level, 32)) + name = self._name_display.display(person) + self.doc.write_text(_("sp. see %(reference)s : %(spouse)s") % + {'reference':display_num, 'spouse':name}, mark) + self.doc.end_paragraph() #------------------------------------------------------------------------ @@ -281,8 +286,9 @@ class RecurseDown(): else: self.objPrint.print_spouse(level, spouse_handle, family) - spouse_num = _("%s sp." % (ref_str)) - self.person_printed[spouse_handle] = spouse_num + if spouse_handle: + spouse_num = _("%s sp." % (ref_str)) + self.person_printed[spouse_handle] = spouse_num if level >= self.max_generations: continue