Fixing issues with get_privacy on non-existent objects which were probably filted out by a living proxy
svn: r15353
This commit is contained in:
@@ -478,7 +478,7 @@ def copy_associations(db, original_obj, clean_obj):
|
|||||||
"""
|
"""
|
||||||
new_person_ref_list = []
|
new_person_ref_list = []
|
||||||
for person_ref in original_obj.get_person_ref_list():
|
for person_ref in original_obj.get_person_ref_list():
|
||||||
if not person_ref.get_privacy():
|
if person_ref and not person_ref.get_privacy():
|
||||||
associated_person = db.get_person_from_handle(person_ref.ref)
|
associated_person = db.get_person_from_handle(person_ref.ref)
|
||||||
if associated_person and not associated_person.get_privacy():
|
if associated_person and not associated_person.get_privacy():
|
||||||
new_person_ref_list.append(person_ref)
|
new_person_ref_list.append(person_ref)
|
||||||
@@ -750,7 +750,7 @@ def sanitize_person(db, person):
|
|||||||
|
|
||||||
# copy names if not private
|
# copy names if not private
|
||||||
name = person.get_primary_name()
|
name = person.get_primary_name()
|
||||||
if name.get_privacy() or person.get_privacy():
|
if (name and name.get_privacy()) or (person and person.get_privacy()):
|
||||||
# Do this so a person always has a primary name of some sort.
|
# Do this so a person always has a primary name of some sort.
|
||||||
name = Name()
|
name = Name()
|
||||||
name.set_surname(_('Private'))
|
name.set_surname(_('Private'))
|
||||||
@@ -767,13 +767,13 @@ def sanitize_person(db, person):
|
|||||||
# copy Family reference list
|
# copy Family reference list
|
||||||
for handle in person.get_parent_family_handle_list():
|
for handle in person.get_parent_family_handle_list():
|
||||||
family = db.get_family_from_handle(handle)
|
family = db.get_family_from_handle(handle)
|
||||||
if family.get_privacy():
|
if family and family.get_privacy():
|
||||||
continue
|
continue
|
||||||
child_ref_list = family.get_child_ref_list()
|
child_ref_list = family.get_child_ref_list()
|
||||||
for child_ref in child_ref_list:
|
for child_ref in child_ref_list:
|
||||||
if (child_ref and
|
if (child_ref and
|
||||||
child_ref.get_reference_handle() == person.get_handle()):
|
child_ref.get_reference_handle() == person.get_handle()):
|
||||||
if not child_ref.get_privacy():
|
if child_ref and not child_ref.get_privacy():
|
||||||
new_person.add_parent_family_handle(handle)
|
new_person.add_parent_family_handle(handle)
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -993,11 +993,11 @@ def sanitize_family(db, family):
|
|||||||
|
|
||||||
# Copy child references.
|
# Copy child references.
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
if child_ref.get_privacy():
|
if child_ref and child_ref.get_privacy():
|
||||||
continue
|
continue
|
||||||
child_handle = child_ref.get_reference_handle()
|
child_handle = child_ref.get_reference_handle()
|
||||||
child = db.get_person_from_handle(child_handle)
|
child = db.get_person_from_handle(child_handle)
|
||||||
if child.get_privacy():
|
if child and child.get_privacy():
|
||||||
continue
|
continue
|
||||||
# Copy this reference
|
# Copy this reference
|
||||||
new_ref = ChildRef()
|
new_ref = ChildRef()
|
||||||
|
Reference in New Issue
Block a user