diff --git a/ChangeLog b/ChangeLog index 2d1f939e8..4c8a8fe7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,16 @@ * src/DataViews/_RelationView.py, * src/DisplayModels/_PeopleModel.py: Only show fallbacks for birth and death if role=primary + * src/Filters/Rules/Person/_HasBirth.py, + * src/Filters/Rules/Person/_HasDeath.py, + * src/Filters/Rules/Person/_HasEvent.py: Only match filter if + event role = primary + * src/RelLib/_Person.py (_remove_handle_references): Correct removing + of person handle reference; (get_sourcref_child_list) Add + self.person_ref_list because they link to persons and sources + * src/DataViews/_PersonView.py (delete_person_response): Remove + person from other persons as well because of PersonRef. + 2006-11-09 Alex Roitman * src/Filters/Rules/Person/_HasDeath.py (apply): Match any of the diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index d4ccbfe83..3f1171df0 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -588,6 +588,15 @@ class PersonView(PageView.PersonNavView): handle = self.active_person.get_handle() + person_list = [ phandle for phandle in self.dbstate.db.get_person_handles(False) + if self.dbstate.db.get_person_from_handle(phandle).has_handle_reference('Person',handle) ] + print "_PersonView.delete_person_response" + print person_list + for phandle in person_list: + person = self.dbstate.db.get_person_from_handle(phandle) + person.remove_handle_references('Person',handle) + self.dbstate.db.commit_person(person,trans) + person = self.active_person self.remove_from_person_list(person) self.dbstate.db.remove_person(handle, trans) diff --git a/src/Filters/Rules/Person/_HasBirth.py b/src/Filters/Rules/Person/_HasBirth.py index 63a4f5424..bd0e27001 100644 --- a/src/Filters/Rules/Person/_HasBirth.py +++ b/src/Filters/Rules/Person/_HasBirth.py @@ -33,7 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from RelLib import EventType +from RelLib import EventType,EventRoleType from Filters.Rules._Rule import Rule from Filters.Rules._RuleUtils import loose_date_cmp @@ -59,6 +59,9 @@ class HasBirth(Rule): def apply(self,db,person): for event_ref in person.get_event_ref_list(): + if event_ref.role != EventRoleType.PRIMARY: + # Only match primaries, no witnesses + continue event = db.get_event_from_handle(event_ref.ref) if event.get_type() != EventType.BIRTH: # No match: wrong type diff --git a/src/Filters/Rules/Person/_HasDeath.py b/src/Filters/Rules/Person/_HasDeath.py index da3296c6b..ad52e7962 100644 --- a/src/Filters/Rules/Person/_HasDeath.py +++ b/src/Filters/Rules/Person/_HasDeath.py @@ -33,7 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from RelLib import EventType +from RelLib import EventType,EventRoleType from Filters.Rules._Rule import Rule from Filters.Rules._RuleUtils import loose_date_cmp @@ -59,6 +59,9 @@ class HasDeath(Rule): def apply(self,db,person): for event_ref in person.get_event_ref_list(): + if event_ref.role != EventRoleType.PRIMARY: + # Only match primaries, no witnesses + continue event = db.get_event_from_handle(event_ref.ref) if event.get_type() != EventType.DEATH: # No match: wrong type diff --git a/src/Filters/Rules/Person/_HasEvent.py b/src/Filters/Rules/Person/_HasEvent.py index f1ee1fea4..0a68a07b0 100644 --- a/src/Filters/Rules/Person/_HasEvent.py +++ b/src/Filters/Rules/Person/_HasEvent.py @@ -32,6 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- +from RelLib import EventRoleType from Filters.Rules._HasEventBase import HasEventBase #------------------------------------------------------------------------- @@ -53,6 +54,9 @@ class HasEvent(HasEventBase): for event_ref in person.get_event_ref_list(): if not event_ref: continue + if event_ref.role != EventRoleType.PRIMARY: + # Only match primaries, no witnesses + continue event = db.get_event_from_handle(event_ref.ref) if HasEventBase.apply(self,db,event): return True diff --git a/src/RelLib/_Person.py b/src/RelLib/_Person.py index c98ab1676..5efa9136d 100644 --- a/src/RelLib/_Person.py +++ b/src/RelLib/_Person.py @@ -233,7 +233,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, self.event_ref_list = new_list elif classname == 'Person': new_list = [ref for ref in self.person_ref_list - if ref not in handle_list] + if ref.ref not in handle_list] self.person_ref_list = new_list elif classname == 'Family': new_list = [ handle for handle in self.family_list @@ -308,7 +308,8 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, """ return [self.primary_name] + self.media_list + \ self.alternate_names + self.address_list + \ - self.attribute_list + self.lds_ord_list + self.attribute_list + self.lds_ord_list + \ + self.person_ref_list def get_referenced_handles(self): """