From 0877cdbf54c4f6145d70fb7c22b0587694776750 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 29 Aug 2013 15:28:35 +0000 Subject: [PATCH] 6960: Error merging citations Error merging citations containing objects with citations. Fixed. svn: r22936 --- src/Merge/mergecitation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Merge/mergecitation.py b/src/Merge/mergecitation.py index 7818efc09..d7d3f7156 100644 --- a/src/Merge/mergecitation.py +++ b/src/Merge/mergecitation.py @@ -30,7 +30,8 @@ Provide merge capabilities for citations. # Gramps modules # #------------------------------------------------------------------------- -from gen.lib import (Person, Family, Event, Place, MediaObject, Repository) +from gen.lib import (Person, Family, Event, Place, + MediaObject, Repository, Citation) from gen.db import DbTxn from gen.ggettext import sgettext as _ import const @@ -225,6 +226,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)