Fix handle errors in person and family editors

This commit is contained in:
Nick Hall 2015-12-13 17:30:40 +00:00
parent 03a72b8319
commit f7c54e9b88
2 changed files with 9 additions and 12 deletions

View File

@ -769,9 +769,8 @@ class EditPerson(EditPrimary):
f.set_child_ref_list(new_order)
error = False
original = self.db.get_person_from_handle(self.obj.handle)
if original:
if not self.added:
original = self.db.get_person_from_handle(self.obj.handle)
(female, male, unknown) = _select_gender[self.obj.get_gender()]
if male and original.get_gender() != Person.MALE:
for tmp_handle in self.obj.get_family_handle_list():

View File

@ -347,14 +347,12 @@ class EditPrimary(ManagedWindow, DbGUIElement):
Return True if a duplicate GRAMPS ID has been detected.
"""
original = None
if self.obj.get_handle():
original = self.get_from_handle(self.obj.get_handle())
if original and original.get_gramps_id() == self.obj.get_gramps_id():
return (False, 0)
else:
idval = self.obj.get_gramps_id()
if self.get_from_gramps_id(idval):
idval = self.obj.get_gramps_id()
existing = self.get_from_gramps_id(idval)
if existing:
if existing.get_handle() == self.obj.get_handle():
return (False, 0)
else:
return (True, idval)
else:
return (False, 0)