From 9487b3c1b744175771d188c2ce49803e2dbbf8cb Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 29 Aug 2013 16:33:21 +0000 Subject: [PATCH] 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 --- gramps/gen/merge/mergecitationquery.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gramps/gen/merge/mergecitationquery.py b/gramps/gen/merge/mergecitationquery.py index be54ce91b..fba082e8b 100644 --- a/gramps/gen/merge/mergecitationquery.py +++ b/gramps/gen/merge/mergecitationquery.py @@ -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)