From 734d81bc79b0057071a3934508c3d40176d61896 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 21 Oct 2007 07:59:42 +0000 Subject: [PATCH] 2007-10-21 Benny Malengier * src/Editors/_EditPerson.py: If a family changes, rebuild family backref of all open editors. issue #1309, causing corrupt database. Also remove unneeded associations rebuild when family changes svn: r9225 --- ChangeLog | 5 +++++ src/Editors/_EditPerson.py | 29 ++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b346d66e..55d133fdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-21 Benny Malengier + * src/Editors/_EditPerson.py: If a family changes, rebuild family backref of all + open editors. issue #1309, causing corrupt database. + Also remove unneeded associations rebuild when family changes + 2007-10-19 Piotr Czubaszek * src/docgen/PdfDoc.py (PdfDoc.add_media_object): Missing period. diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index 897777ae5..6104b849d 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -166,19 +166,34 @@ class EditPerson(EditPrimary): self._add_db_signal('family-add', self.family_change) def family_change(self, handle_list): - flist = self.obj.get_family_handle_list() + self.obj.get_parent_family_handle_list() - for handle in handle_list: - if handle in flist: - self._update_families() - return + """Callback for family change signals. This should rebuild the + backreferences to family in person when: + 1)a family the person is parent of changes. Person could have + been removed + 2)a family the person is child in changes. Child could have been + removed + 3)a family is changed. The person could be added as child or + parent + """ + #As this would be an extensive check, we choose the easy path and + # rebuild family backreferences on all family changes + + ##flist = self.obj.get_family_handle_list() + \ + ## self.obj.get_parent_family_handle_list() + ##for handle in handle_list: + ## if handle in flist: + ## self._update_families() + ## return + + self._update_families() def _update_families(self): phandle = self.obj.get_handle() person = self.dbstate.db.get_person_from_handle(phandle) self.obj.set_family_handle_list(person.get_family_handle_list()) self.obj.set_parent_family_handle_list(person.get_parent_family_handle_list()) - self.person_ref_list.data = self.obj.get_person_ref_list() - self.person_ref_list.rebuild() + #self.person_ref_list.data = self.obj.get_person_ref_list() + #self.person_ref_list.rebuild() def _setup_fields(self): """