handle some report pathological cases (better)

This commit is contained in:
Paul Franklin 2016-10-13 12:44:16 -07:00
parent b29682cafb
commit eea104b8a6
4 changed files with 13 additions and 5 deletions

View File

@ -63,6 +63,7 @@ from gramps.gen.plug.menu import (NumberOption, ColorOption, BooleanOption,
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.utils.location import get_main_location
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.errors import ReportError
#------------------------------------------------------------------------
#
@ -370,8 +371,8 @@ class FamilyLinesReport(Report):
# entire list right now and not have to deal with it ever again
self._interest_set = set()
if not self._gidlist:
self._user.warn(_('Empty report'),
_('You did not specify anybody'))
raise ReportError(_('Empty report'),
_('You did not specify anybody'))
for gid in self._gidlist.split():
person = self._db.get_person_from_gramps_id(gid)
if person:

View File

@ -61,6 +61,7 @@ from gramps.gen.relationship import get_relationship_calculator
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.display.place import displayer as _pd
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.errors import ReportError
#------------------------------------------------------------------------
#
@ -174,6 +175,8 @@ class RelGraphReport(Report):
pid = get_value('pid')
self.center_person = self._db.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
self.increlname = get_value('increlname')
if self.increlname:

View File

@ -50,6 +50,7 @@ from gramps.gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gramps.gen.display.place import displayer as _pd
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.errors import ReportError
#------------------------------------------------------------------------
#
@ -671,9 +672,8 @@ class FamilyGroup(Report):
self.doc.page_break()
step()
else:
self.doc.start_paragraph('FGR-Title')
self.doc.write_text(self._("Family Group Report"))
self.doc.end_paragraph()
raise ReportError(_('Empty report'),
_('You did not specify anybody'))
#------------------------------------------------------------------------
#

View File

@ -60,6 +60,7 @@ from gramps.gen.utils.file import media_path_full
from gramps.gen.utils.lds import TEMPLES
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.relationship import get_relationship_calculator
from gramps.gen.errors import ReportError
#------------------------------------------------------------------------
#
@ -807,6 +808,9 @@ class IndivCompleteReport(Report):
ind_list = self.filter.apply(self._db, plist)
else:
ind_list = plist
if not ind_list:
raise ReportError(_('Empty report'),
_('You did not specify anybody'))
for count, person_handle in enumerate(ind_list):
self.person = self._db.get_person_from_handle(person_handle)