Fix bug that wasn't taking account of the fact that event references in Person and Family have attributes which themselves can have Citations.

* In Person, add event_ref_list to get_citation_child_list (therefore it is no longer needed in get_handle_referents)
* Similarly in Family, add event_ref_list to get_citation_child_list
* Enhance upgrade to add upgrade of event_ref_list for person and family
* Add has_citation_reference, replace_citation_references and remove_citation_references to EventRef
* Change name of remove_citation_refs to remove_citation_references to be consistent with has_citation_reference (singular) and replace_citation_references

Fix editcitation because it was displaying the wrong privacy button for sources.
Also remove FIXME for editcitation for db signal connect, because comment explains why it is not needed.


svn: r18469
This commit is contained in:
Tim G L Lyons
2011-11-20 17:42:04 +00:00
parent 8f69e88555
commit 9f29350da4
9 changed files with 92 additions and 33 deletions

View File

@@ -152,6 +152,47 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
"""
return self.get_citation_child_list()
def has_citation_reference(self, citation_handle) :
"""
Return True if any of the child objects has reference to this citation
handle.
:param citation_handle: The citation handle to be checked.
:type citation_handle: str
:returns: Returns whether any of it's child objects has reference to
this citation handle.
:rtype: bool
"""
for item in self.get_citation_child_list():
if item.has_citation_reference(citation_handle):
return True
return False
def remove_citation_references(self, citation_handle_list):
"""
Remove references to all citation handles in the list in all child
objects.
:param citation_handle_list: The list of citation handles to be removed.
:type citation_handle_list: list
"""
for item in self.get_citation_child_list():
item.remove_citation_references(citation_handle_list)
def replace_citation_references(self, old_handle, new_handle):
"""
Replace references to citation handles in the list in this object and
all child objects and merge equivalent entries.
:param old_handle: The citation handle to be replaced.
:type old_handle: str
:param new_handle: The citation handle to replace the old one with.
:type new_handle: str
"""
for item in self.get_citation_child_list():
item.replace_citation_references(old_handle, new_handle)
def is_equivalent(self, other):
"""
Return if this eventref is equivalent, that is agrees in handle and