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:
#reports.testall(TestDynamic)
def output_contains(text):
def report_contains(text):
def test_output_file(out, err, report_name):
contents = open(report_name + ".txt").read()
print(contents)
return text in contents
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",
output_contains("I0037 Smith, Edwin Michael"),
report_contains("I0037 Smith, Edwin Michael"),
'off=txt,tag=tag1')
reports.addtest(TestDynamic, "navwebpage",
err_does_not_contain("Failed to write report."),
'off=html')
if __name__ == "__main__":
unittest.main()

View File

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