0001012: Private source and private child references shown in narrative website.

svn: r8385
This commit is contained in:
Brian Matherly 2007-04-15 19:12:57 +00:00
parent 166dfc6e8b
commit a8621d50ea
3 changed files with 33 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2007-04-14 Brian Matherly <brian@gramps-project.org>
* src/plugins/NarrativeWeb.py
* src/ReportBase/_ReportUtils.py
0001012: Private source and private child references shown in narrative
website.
2007-04-14 Brian Matherly <brian@gramps-project.org> 2007-04-14 Brian Matherly <brian@gramps-project.org>
* src\data\main4.css * src\data\main4.css
* src\data\main5.css * src\data\main5.css

View File

@ -1189,7 +1189,7 @@ def sanitize_list(obj_list,exclude_private):
@rtype: list @rtype: list
""" """
if exclude_private: if exclude_private:
return [obj for obj in obj_list if not obj.private] return [obj for obj in obj_list if not obj.get_privacy()]
else: else:
return obj_list return obj_list
@ -1253,8 +1253,15 @@ def sanitize_person(db,person):
new_person.add_family_handle(handle) new_person.add_family_handle(handle)
# copy Family reference list # copy Family reference list
for item in person.get_parent_family_handle_list(): for handle in person.get_parent_family_handle_list():
new_person.add_parent_family_handle(item) family = db.get_family_from_handle(handle)
child_ref_list = family.get_child_ref_list()
for child_ref in child_ref_list:
if child_ref.get_reference_handle() == person.get_handle():
if child_ref.get_privacy() == False:
new_person.add_parent_family_handle(handle)
break
if person.get_privacy(): if person.get_privacy():
return new_person return new_person

View File

@ -1670,7 +1670,9 @@ class IndividualPage(BasePage):
self.pedigree_person(of,mother,True) self.pedigree_person(of,mother,True)
of.write('<div class="pedigreegen">\n') of.write('<div class="pedigreegen">\n')
if family: if family:
for child_ref in family.get_child_ref_list(): childlist = ReportUtils.sanitize_list( family.get_child_ref_list(),
self.exclude_private )
for child_ref in childlist:
child_handle = child_ref.ref child_handle = child_ref.ref
if child_handle == self.person.handle: if child_handle == self.person.handle:
of.write('<span class="thisperson">%s</span><br />\n' % self.name) of.write('<span class="thisperson">%s</span><br />\n' % self.name)
@ -1848,7 +1850,8 @@ class IndividualPage(BasePage):
frel = "" frel = ""
mrel = "" mrel = ""
child_handle = self.person.get_handle() child_handle = self.person.get_handle()
child_ref_list = family.get_child_ref_list() child_ref_list = ReportUtils.sanitize_list( family.get_child_ref_list(),
self.exclude_private )
for child_ref in child_ref_list: for child_ref in child_ref_list:
if child_ref.ref == child_handle: if child_ref.ref == child_handle:
frel = str(child_ref.get_father_relation()) frel = str(child_ref.get_father_relation())
@ -1870,12 +1873,11 @@ class IndividualPage(BasePage):
self.display_parent(of,mother_handle,_('Mother'),mrel) self.display_parent(of,mother_handle,_('Mother'),mrel)
of.write('</tr>\n') of.write('</tr>\n')
first = False first = False
childlist = family.get_child_ref_list() if len(child_ref_list) > 1:
if len(childlist) > 1:
of.write('<tr>\n') of.write('<tr>\n')
of.write('<td class="field">%s</td>\n' % _("Siblings")) of.write('<td class="field">%s</td>\n' % _("Siblings"))
of.write('<td class="data">\n') of.write('<td class="data">\n')
for child_ref in childlist: for child_ref in child_ref_list:
child_handle = child_ref.ref child_handle = child_ref.ref
if child_handle != self.person.handle: if child_handle != self.person.handle:
self.display_child_link(of,child_handle) self.display_child_link(of,child_handle)
@ -1898,7 +1900,8 @@ class IndividualPage(BasePage):
family = self.db.get_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
self.display_spouse(of,family,first) self.display_spouse(of,family,first)
first = False first = False
childlist = family.get_child_ref_list() childlist = ReportUtils.sanitize_list( family.get_child_ref_list(),
self.exclude_private )
if childlist: if childlist:
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
of.write('<td class="field">%s</td>\n' % _("Children")) of.write('<td class="field">%s</td>\n' % _("Children"))
@ -2011,7 +2014,8 @@ class IndividualPage(BasePage):
if self.exclude_private: if self.exclude_private:
spouse = ReportUtils.sanitize_person( self.db, spouse) spouse = ReportUtils.sanitize_person( self.db, spouse)
self.pedigree_person(of,spouse,True) self.pedigree_person(of,spouse,True)
childlist = rel_family.get_child_ref_list() childlist = ReportUtils.sanitize_list( rel_family.get_child_ref_list(),
self.exclude_private )
if childlist: if childlist:
of.write('<div class="pedigreegen">\n') of.write('<div class="pedigreegen">\n')
for child_ref in childlist: for child_ref in childlist:
@ -2067,6 +2071,9 @@ class IndividualPage(BasePage):
if self.exclude_private and sref.private: if self.exclude_private and sref.private:
continue continue
handle = sref.get_reference_handle() handle = sref.get_reference_handle()
source = self.db.get_source_from_handle(handle)
if source.get_privacy() == True:
continue
gid_list.append(sref) gid_list.append(sref)
if self.src_list.has_key(handle): if self.src_list.has_key(handle):
@ -2134,7 +2141,7 @@ class WebReport(Report):
self.css = options.handler.options_dict['NWEBcss'] self.css = options.handler.options_dict['NWEBcss']
self.restrict = options.handler.options_dict['NWEBrestrictinfo'] self.restrict = options.handler.options_dict['NWEBrestrictinfo']
self.restrict_years = options.handler.options_dict['NWEBrestrictyears'] self.restrict_years = options.handler.options_dict['NWEBrestrictyears']
self.exclude_private = options.handler.options_dict['NWEBincpriv'] self.exclude_private = not options.handler.options_dict['NWEBincpriv']
self.noid = options.handler.options_dict['NWEBnoid'] self.noid = options.handler.options_dict['NWEBnoid']
self.title = options.handler.options_dict['NWEBtitle'] self.title = options.handler.options_dict['NWEBtitle']
self.sort = Sort.Sort(self.database) self.sort = Sort.Sort(self.database)
@ -2254,7 +2261,7 @@ class WebReport(Report):
# if private records need to be filtered out, strip out any person # if private records need to be filtered out, strip out any person
# that has the private flag set. # that has the private flag set.
if not self.exclude_private: if self.exclude_private:
self.progress.set_pass(_('Applying privacy filter'),len(ind_list)) self.progress.set_pass(_('Applying privacy filter'),len(ind_list))
ind_list = filter(self.filter_private,ind_list) ind_list = filter(self.filter_private,ind_list)
@ -2302,7 +2309,7 @@ class WebReport(Report):
self.progress.step() self.progress.step()
person = self.database.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
if not self.exclude_private: if self.exclude_private:
person = ReportUtils.sanitize_person(self.database,person) person = ReportUtils.sanitize_person(self.database,person)
IndividualPage( IndividualPage(