6960: Error merging citations
Error merging citations containing objects with citations. reapply from gramps40 the fix to MergeCitationQuery merge_ref_test suite still fails :( svn: r22938
This commit is contained in:
parent
0bf91f7708
commit
9487b3c1b7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user