9284: Narrative Report with BSDDB, additional fixes and test

This commit is contained in:
Doug Blank 2016-03-02 09:13:35 -06:00
parent 7dca404669
commit 8d08b62c8d
2 changed files with 32 additions and 11 deletions

View File

@ -102,16 +102,26 @@ reports = ReportControl()
# If you could run all reports in a standard way: # If you could run all reports in a standard way:
#reports.testall(TestDynamic) #reports.testall(TestDynamic)
def output_contains(text): def report_contains(text):
def test_output_file(out, err, report_name): def test_output_file(out, err, report_name):
contents = open(report_name + ".txt").read() contents = open(report_name + ".txt").read()
print(contents) print(contents)
return text in contents return text in contents
return test_output_file return test_output_file
def err_does_not_contain(text):
def test_output_file(out, err, report_name):
print(err)
return text not in err
return test_output_file
reports.addtest(TestDynamic, "tag_report", reports.addtest(TestDynamic, "tag_report",
output_contains("I0037 Smith, Edwin Michael"), report_contains("I0037 Smith, Edwin Michael"),
'off=txt,tag=tag1') 'off=txt,tag=tag1')
reports.addtest(TestDynamic, "navwebpage",
err_does_not_contain("Failed to write report."),
'off=html')
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View File

@ -6053,7 +6053,10 @@ class PersonPages(BasePage):
if gen_nr > maxgen: if gen_nr > maxgen:
return tree return tree
gen_offset = int(max_size / pow(2, gen_nr+1)) gen_offset = int(max_size / pow(2, gen_nr+1))
if person_handle:
person = self.dbase_.get_person_from_handle(person_handle) person = self.dbase_.get_person_from_handle(person_handle)
else:
person = None
if not person: if not person:
return tree return tree
@ -6160,8 +6163,9 @@ class PersonPages(BasePage):
for birthdate, handle in children: for birthdate, handle in children:
if handle == self.person.get_handle(): if handle == self.person.get_handle():
child_ped(ol) child_ped(ol)
else: elif handle:
child = self.dbase_.get_person_from_handle(handle) child = self.dbase_.get_person_from_handle(handle)
if child:
ol += Html("li") + self.pedigree_person(child) ol += Html("li") + self.pedigree_person(child)
else: else:
child_ped(ol) child_ped(ol)
@ -6181,8 +6185,14 @@ class PersonPages(BasePage):
family = self.dbase_.get_family_from_handle(parent_handle) family = self.dbase_.get_family_from_handle(parent_handle)
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.dbase_.get_person_from_handle(mother_handle) mother = self.dbase_.get_person_from_handle(mother_handle)
else:
mother = None
if father_handle:
father = self.dbase_.get_person_from_handle(father_handle) father = self.dbase_.get_person_from_handle(father_handle)
else:
father = None
else: else:
family = None family = None
father = None father = None
@ -6588,6 +6598,7 @@ class PersonPages(BasePage):
pedsp += [childol] pedsp += [childol]
for child_ref in childlist: for child_ref in childlist:
child = self.dbase_.get_person_from_handle(child_ref.ref) child = self.dbase_.get_person_from_handle(child_ref.ref)
if child:
childol += (Html("li") + childol += (Html("li") +
self.pedigree_person(child) self.pedigree_person(child)
) )
@ -7718,7 +7729,7 @@ class NavWebReport(Report):
self.write_gendex(gendex_io, person) self.write_gendex(gendex_io, person)
else: else:
self.write_gendex(fp_gendex, person) self.write_gendex(fp_gendex, person)
self.close_file(fp_gendex, gendex_io, date) self.close_file(fp_gendex, gendex_io, 0)
def write_gendex(self, fp, person): def write_gendex(self, fp, person):
""" """