5145: attempted deletion stopped

svn: r18020
This commit is contained in:
Michiel Nauta 2011-08-09 20:34:21 +00:00
parent cb87cc85de
commit 6cbe9e31b5

View File

@ -40,6 +40,7 @@ from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from txn import DbTxn from txn import DbTxn
from exceptions import DbTransactionCancel
class DbReadBase(object): class DbReadBase(object):
""" """
@ -1693,6 +1694,11 @@ class DbWriteBase(DbReadBase):
elif family.get_mother_handle() == person_handle: elif family.get_mother_handle() == person_handle:
msg = _("Remove mother from family") msg = _("Remove mother from family")
family.set_mother_handle(None) family.set_mother_handle(None)
else:
raise DbTransactionCancel("The relation between the person and "
"the family you try to remove is not consistent, please fix "
"that first, for example from the family editor or by running "
"the database repair tool, before removing the family.")
if (not family.get_father_handle() and not family.get_mother_handle() if (not family.get_father_handle() and not family.get_mother_handle()
and not family.get_child_ref_list()): and not family.get_child_ref_list()):