0002542: Crash whilst generating web pages from command line

Throwing Report Error if center person is not in database. Added catching of Report Error to CommandLineReport
if using GUI it is not possible to cause this, as you have to select a person that is in the DB. However on the command line you can specify any PID and even no person with that pid exists an error was thrown.

svn: r13004
This commit is contained in:
Raphael Ackermann
2009-08-14 07:14:25 +00:00
parent 9b676e0f0f
commit 30d6eebd0b
17 changed files with 169 additions and 143 deletions

View File

@@ -35,13 +35,14 @@ from TransUtils import sgettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle,\
FONT_SANS_SERIF, PARA_ALIGN_CENTER
from SubstKeywords import SubstKeywords
from BasicUtils import name_displayer
from Errors import ReportError
from gen.plug import PluginManager
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
from gen.plug.menu import BooleanOption, NumberOption, TextOption, PersonOption
from ReportBase import Report, ReportUtils, CATEGORY_DRAW, MenuReportOptions
from BasicUtils import name_displayer
from SubstKeywords import SubstKeywords
pt2cm = ReportUtils.pt2cm
@@ -190,6 +191,8 @@ class AncestorTree(Report):
pid = menu.get_option_by_name('pid').get_value()
center_person = database.get_person_from_gramps_id(pid)
if (center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
name = name_displayer.display_formal(center_person)
self.title = _("Ancestor Graph for %s") % name

View File

@@ -34,19 +34,20 @@ import time
# GRAMPS modules
#
#------------------------------------------------------------------------
from BasicUtils import name_displayer
from Errors import ReportError
from gen.plug import PluginManager
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SERIF, PARA_ALIGN_CENTER,
PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT)
from gen.plug.docgen.fontscale import string_trim
from BasicUtils import name_displayer
from gen.plug import PluginManager
from gen.plug.menu import (BooleanOption, StringOption, NumberOption,
EnumeratedListOption, FilterOption, PersonOption)
from gui.utils import ProgressMeter
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
from gen.plug.menu import BooleanOption, StringOption, NumberOption, \
EnumeratedListOption, FilterOption, PersonOption
from Utils import probably_alive
import GrampsLocale
import gen.lib
from Utils import probably_alive
from gui.utils import ProgressMeter
import libholiday
from libholiday import g2iso
@@ -87,6 +88,8 @@ class Calendar(Report):
self.filter = self.filter_option.get_filter()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
def get_name(self, person, maiden_name = None):
""" Return person's name, unless maiden_name given,

View File

@@ -30,13 +30,14 @@
#
#------------------------------------------------------------------------
from BasicUtils import name_displayer
from Errors import ReportError
from gen.plug import PluginManager
from gen.plug.docgen import (GraphicsStyle, FontStyle, ParagraphStyle,
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
from gen.plug.menu import TextOption, NumberOption, BooleanOption, PersonOption
from ReportBase import Report, MenuReportOptions, ReportUtils, CATEGORY_DRAW
from SubstKeywords import SubstKeywords
from TransUtils import sgettext as _
from gen.plug.docgen import GraphicsStyle, FontStyle, ParagraphStyle,\
FONT_SANS_SERIF, PARA_ALIGN_CENTER
#------------------------------------------------------------------------
#
@@ -145,6 +146,8 @@ class DescendTree(Report):
self.incblank = menu.get_option_by_name('incblank').get_value()
pid = menu.get_option_by_name('pid').get_value()
center_person = database.get_person_from_gramps_id(pid)
if (center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
self.showspouse = menu.get_option_by_name('shows').get_value()

View File

@@ -33,9 +33,10 @@ from gettext import gettext as _
# gramps modules
#
#------------------------------------------------------------------------
from Errors import ReportError
from gen.plug import PluginManager
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
from gen.plug import PluginManager
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
from SubstKeywords import SubstKeywords
@@ -90,6 +91,8 @@ class FanChart(Report):
self.radial = menu.get_option_by_name('radial').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
self.background_style = []
self.text_style = []