5145: attempted deletion stopped

svn: r18021
This commit is contained in:
Michiel Nauta 2011-08-09 20:35:04 +00:00
parent 91db57f9ee
commit 4e85f80613

View File

@ -40,6 +40,7 @@ from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
import gen.lib
from txn import DbTxn
from exceptions import DbTransactionCancel
class DbReadBase(object):
"""
@ -1689,6 +1690,11 @@ class DbWriteBase(object):
elif family.get_mother_handle() == person_handle:
msg = _("Remove mother from family")
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()
and not family.get_child_ref_list()):