From 52d06de4912f762cf2776f8a38edc178c1431a65 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 27 Jul 2005 00:58:17 +0000 Subject: [PATCH] * src/ChooseParents.py (save_parents_clicked): Do not create family if parent is self. svn: r4970 --- gramps2/ChangeLog | 4 ++++ gramps2/src/ChooseParents.py | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9671a4100..4003a12b8 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-07-26 Alex Roitman + * src/ChooseParents.py (save_parents_clicked): Do not create + family if parent is self. + 2005-07-26 Don Allingham * src/EditPerson.py: NameDisplay enhancements * src/FamilyView.py: NameDisplay enhancements diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index d1973b39e..ce44794ee 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -555,20 +555,21 @@ class ChooseParents: self.type = "Partners" father_handle = self.father.get_handle() mother_handle = self.mother.get_handle() - self.family = self.find_family(father_handle,mother_handle,trans) - else: - self.family = None - if self.family: - if self.person.get_handle() in (father_handle,mother_handle): - ErrorDialog(_("Error selecting a child"), - _("A person cannot be linked as his/her own parent"), - self.window) - return + if self.person.get_handle() in (father_handle,mother_handle): + ErrorDialog(_("Error selecting a child"), + _("A person cannot be linked as his/her own parent"), + self.window) + return + + if father_handle or mother_handle: + self.family = self.find_family(father_handle,mother_handle,trans) self.family.add_child_handle(self.person.get_handle()) self.family.set_relationship(self.type) self.change_family_type(self.family,mother_rel,father_rel) self.db.commit_family(self.family,trans) + else: + self.family = None self.db.transaction_commit(trans,_("Choose Parents")) self.close(None)