bug 9844; fix QuickReports for Cairo crash when no objects found

This commit is contained in:
prculley 2016-12-20 10:08:53 -06:00 committed by Nick Hall
parent 55edefd4b8
commit b71b4e9c7f
5 changed files with 28 additions and 8 deletions

View File

@ -81,7 +81,8 @@ def run(database, document, date):
sdoc.paragraph(_("\nLiving matches: %(alive)d, "
"Deceased matches: %(dead)d\n") %
{'alive' : alive_matches, 'dead' : dead_matches})
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
sdoc.paragraph("")
def get_event_date_from_ref(database, ref):

View File

@ -64,7 +64,10 @@ def run(database, document, person):
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found"))
def run_fam(database, document, family):
"""
@ -98,7 +101,8 @@ def run_fam(database, document, family):
# display the results
sdoc.title(_("Sorted events of family\n %(father)s - %(mother)s") % {
'father' : sdb.name(sdb.father(family)), 'mother' : sdb.name(sdb.mother(family)) })
'father': sdb.name(sdb.father(family)),
'mother': sdb.name(sdb.mother(family))})
sdoc.paragraph("")
document.has_data = False
@ -110,7 +114,10 @@ def run_fam(database, document, family):
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found\n"))
stab = QuickTable(sdb)
sdoc.header1(_("Personal events of the children"))
@ -121,4 +128,7 @@ def run_fam(database, document, family):
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found\n"))

View File

@ -44,4 +44,7 @@ def run(database, document, attribute, value=None):
matches += 1
document.has_data = matches > 0
sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches)
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found"))

View File

@ -77,4 +77,7 @@ def run(database, document, repo):
stab.row(src.get_title(), media, call)
document.has_data = True
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found"))

View File

@ -66,4 +66,7 @@ def run(database, document, person):
sdb.birth_or_fallback(child),
rel_str)
document.has_data = True
stab.write(sdoc)
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found\n"))