migrate the existing uses to the new add_private_data_option method

This commit is contained in:
Paul Franklin 2014-07-22 10:45:00 -07:00
parent 59c92d1207
commit 1ef95df160
3 changed files with 9 additions and 11 deletions

View File

@ -82,4 +82,4 @@ def add_private_data_option(menu, category, default=True):
"""
incl_private = BooleanOption(_("Include data marked private"), default)
incl_private.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incl_private", incl_private)
menu.add_option(category, "incl_private", incl_private)

View File

@ -69,7 +69,7 @@ class PlaceReport(Report):
places - List of places to report on.
center - Center of report, person or event
incpriv - Whether to include private data
incl_private - Whether to include private data
name_format - Preferred format to display names
"""
@ -80,14 +80,14 @@ class PlaceReport(Report):
menu = options.menu
places = menu.get_option_by_name('places').get_value()
self.center = menu.get_option_by_name('center').get_value()
self.incpriv = menu.get_option_by_name('incpriv').get_value()
incl_private = menu.get_option_by_name('incl_private').get_value()
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_name_format_option(self, menu)
self._nd = self._name_display
if self.incpriv:
if incl_private:
self.database = database
else:
self.database = PrivateProxyDb(database)
@ -400,9 +400,7 @@ class PlaceOptions(MenuReportOptions):
center.set_help(_("If report is event or person centered"))
menu.add_option(category_name, "center", center)
incpriv = BooleanOption(_("Include private data"), True)
incpriv.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incpriv", incpriv)
stdoptions.add_private_data_option(menu, category_name)
stdoptions.add_localization_option(menu, category_name)

View File

@ -119,6 +119,7 @@ from gramps.gen.plug.menu import PersonOption, NumberOption, StringOption, \
from gramps.gen.plug.report import ( Report, Bibliography)
from gramps.gen.plug.report import utils as ReportUtils
from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.gen.utils.config import get_researcher
from gramps.gen.utils.string import conf_strings
@ -6867,6 +6868,7 @@ class NavWebReport(Report):
database - the GRAMPS database instance
options - instance of the Options class for this report
user - instance of a gen.user.User()
incl_private - Whether to include private data
"""
Report.__init__(self, database, options, user)
self.user = user
@ -6878,7 +6880,7 @@ class NavWebReport(Report):
menuopt = menu.get_option_by_name(optname)
self.options[optname] = menuopt.get_value()
if not self.options['incpriv']:
if not self.options['incl_private']:
self.database = PrivateProxyDb(database)
else:
self.database = database
@ -8215,9 +8217,7 @@ class NavWebOptions(MenuReportOptions):
category_name = _("Privacy")
addopt = partial(menu.add_option, category_name)
incpriv = BooleanOption(_("Include records marked private"), False)
incpriv.set_help(_('Whether to include private objects'))
addopt( "incpriv", incpriv )
stdoptions.add_private_data_option(menu, category_name, default=False)
self.__living = EnumeratedListOption(_("Living People"),
LivingProxyDb.MODE_EXCLUDE_ALL)