From 6468dc2a232ad10422181322e37c845c3c3d5fc2 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sun, 15 Apr 2007 19:09:55 +0000 Subject: [PATCH] 0001012: Private source and private child references shown in narrative website. svn: r8384 --- ChangeLog | 6 ++++++ src/ReportBase/_ReportUtils.py | 13 ++++++++++--- src/plugins/NarrativeWeb.py | 27 +++++++++++++++++---------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b60c7f91..3b2f5f5d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-14 Brian Matherly + * src/plugins/NarrativeWeb.py + * src/ReportBase/_ReportUtils.py + 0001012: Private source and private child references shown in narrative + website. + 2007-04-14 Brian Matherly * src\data\main4.css * src\data\main5.css diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py index 4679fcbd9..da4eacd7b 100644 --- a/src/ReportBase/_ReportUtils.py +++ b/src/ReportBase/_ReportUtils.py @@ -1085,7 +1085,7 @@ def sanitize_list(obj_list,exclude_private): @rtype: list """ 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: return obj_list @@ -1149,8 +1149,15 @@ def sanitize_person(db,person): new_person.add_family_handle(handle) # copy Family reference list - for item in person.get_parent_family_handle_list(): - new_person.add_parent_family_handle(item) + for handle in person.get_parent_family_handle_list(): + 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(): return new_person diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index db1a26a04..6ae2cdee1 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -1665,7 +1665,9 @@ class IndividualPage(BasePage): self.pedigree_person(of,mother,True) of.write('
\n') 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 if child_handle == self.person.handle: of.write('%s
\n' % self.name) @@ -1843,7 +1845,8 @@ class IndividualPage(BasePage): frel = "" mrel = "" 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: if child_ref.ref == child_handle: frel = str(child_ref.get_father_relation()) @@ -1865,12 +1868,11 @@ class IndividualPage(BasePage): self.display_parent(of,mother_handle,_('Mother'),mrel) of.write('\n') first = False - childlist = family.get_child_ref_list() - if len(childlist) > 1: + if len(child_ref_list) > 1: of.write('\n') of.write('%s\n' % _("Siblings")) of.write('\n') - for child_ref in childlist: + for child_ref in child_ref_list: child_handle = child_ref.ref if child_handle != self.person.handle: self.display_child_link(of,child_handle) @@ -1893,7 +1895,8 @@ class IndividualPage(BasePage): family = self.db.get_family_from_handle(family_handle) self.display_spouse(of,family,first) first = False - childlist = family.get_child_ref_list() + childlist = ReportUtils.sanitize_list( family.get_child_ref_list(), + self.exclude_private ) if childlist: of.write(' \n') of.write('%s\n' % _("Children")) @@ -2003,7 +2006,8 @@ class IndividualPage(BasePage): if self.exclude_private: spouse = ReportUtils.sanitize_person( self.db, spouse) 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: of.write('
\n') for child_ref in childlist: @@ -2059,6 +2063,9 @@ class IndividualPage(BasePage): if self.exclude_private and sref.private: continue handle = sref.get_reference_handle() + source = self.db.get_source_from_handle(handle) + if source.get_privacy() == True: + continue gid_list.append(sref) if self.src_list.has_key(handle): @@ -2126,7 +2133,7 @@ class WebReport(Report): self.css = options.handler.options_dict['NWEBcss'] self.restrict = options.handler.options_dict['NWEBrestrictinfo'] 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.title = options.handler.options_dict['NWEBtitle'] self.sort = Sort.Sort(self.database) @@ -2246,7 +2253,7 @@ class WebReport(Report): # if private records need to be filtered out, strip out any person # 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)) ind_list = filter(self.filter_private,ind_list) @@ -2294,7 +2301,7 @@ class WebReport(Report): self.progress.step() 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) IndividualPage(