6960: error merging citations

merge_ref_test still fails...

svn: r22937
This commit is contained in:
Vassilii Khachaturov 2013-08-29 16:20:29 +00:00
parent 0e3c01d6aa
commit ca929cfb2f

View File

@ -30,7 +30,8 @@ Provide merge capabilities for citations.
# Gramps modules
#
#-------------------------------------------------------------------------
from ..lib import (Person, Family, Event, Place, MediaObject, Repository)
from ..lib import (Person, Family, Event, Place,
MediaObject, Repository, Citation)
from ..db import DbTxn
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
@ -94,6 +95,12 @@ class MergeCitationQuery(object):
repository.replace_citation_references(old_handle,
new_handle)
self.database.commit_repository(repository, trans)
elif class_name == Citation.__name__:
citation = self.database.get_citation_from_handle(handle)
assert(citation.has_citation_reference(old_handle))
citation.replace_citation_references(old_handle,
new_handle)
self.database.commit_citation(citation, trans)
else:
raise MergeError("Encounter an object of type %s that has "
"a citation reference." % class_name)