handle some report pathological cases (better)
This commit is contained in:
parent
b29682cafb
commit
eea104b8a6
@ -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.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
from gramps.gen.utils.location import get_main_location
|
from gramps.gen.utils.location import get_main_location
|
||||||
from gramps.gen.proxy import CacheProxyDb
|
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
|
# entire list right now and not have to deal with it ever again
|
||||||
self._interest_set = set()
|
self._interest_set = set()
|
||||||
if not self._gidlist:
|
if not self._gidlist:
|
||||||
self._user.warn(_('Empty report'),
|
raise ReportError(_('Empty report'),
|
||||||
_('You did not specify anybody'))
|
_('You did not specify anybody'))
|
||||||
for gid in self._gidlist.split():
|
for gid in self._gidlist.split():
|
||||||
person = self._db.get_person_from_gramps_id(gid)
|
person = self._db.get_person_from_gramps_id(gid)
|
||||||
if person:
|
if person:
|
||||||
|
@ -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.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
from gramps.gen.display.place import displayer as _pd
|
from gramps.gen.display.place import displayer as _pd
|
||||||
from gramps.gen.proxy import CacheProxyDb
|
from gramps.gen.proxy import CacheProxyDb
|
||||||
|
from gramps.gen.errors import ReportError
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -174,6 +175,8 @@ class RelGraphReport(Report):
|
|||||||
|
|
||||||
pid = get_value('pid')
|
pid = get_value('pid')
|
||||||
self.center_person = self._db.get_person_from_gramps_id(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')
|
self.increlname = get_value('increlname')
|
||||||
if self.increlname:
|
if self.increlname:
|
||||||
|
@ -50,6 +50,7 @@ from gramps.gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
|
|||||||
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
|
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
|
||||||
from gramps.gen.display.place import displayer as _pd
|
from gramps.gen.display.place import displayer as _pd
|
||||||
from gramps.gen.proxy import CacheProxyDb
|
from gramps.gen.proxy import CacheProxyDb
|
||||||
|
from gramps.gen.errors import ReportError
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -671,9 +672,8 @@ class FamilyGroup(Report):
|
|||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
step()
|
step()
|
||||||
else:
|
else:
|
||||||
self.doc.start_paragraph('FGR-Title')
|
raise ReportError(_('Empty report'),
|
||||||
self.doc.write_text(self._("Family Group Report"))
|
_('You did not specify anybody'))
|
||||||
self.doc.end_paragraph()
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -60,6 +60,7 @@ from gramps.gen.utils.file import media_path_full
|
|||||||
from gramps.gen.utils.lds import TEMPLES
|
from gramps.gen.utils.lds import TEMPLES
|
||||||
from gramps.gen.proxy import CacheProxyDb
|
from gramps.gen.proxy import CacheProxyDb
|
||||||
from gramps.gen.relationship import get_relationship_calculator
|
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)
|
ind_list = self.filter.apply(self._db, plist)
|
||||||
else:
|
else:
|
||||||
ind_list = plist
|
ind_list = plist
|
||||||
|
if not ind_list:
|
||||||
|
raise ReportError(_('Empty report'),
|
||||||
|
_('You did not specify anybody'))
|
||||||
|
|
||||||
for count, person_handle in enumerate(ind_list):
|
for count, person_handle in enumerate(ind_list):
|
||||||
self.person = self._db.get_person_from_handle(person_handle)
|
self.person = self._db.get_person_from_handle(person_handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user