From 64d3a217f13b26ef2d07d83db9a2501da50bcf1d Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Fri, 30 Aug 2013 22:33:58 +0000 Subject: [PATCH] 6960: Bless Source with an IndirectCitationBase svn: r22970 --- gramps/gen/lib/src.py | 4 +++- gramps/gen/merge/mergecitationquery.py | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gramps/gen/lib/src.py b/gramps/gen/lib/src.py index ea4543f21..37561ce2d 100644 --- a/gramps/gen/lib/src.py +++ b/gramps/gen/lib/src.py @@ -40,13 +40,15 @@ from .reporef import RepoRef from .const import DIFFERENT, EQUAL, IDENTICAL from ..constfunc import cuni from .handle import Handle +from .citationbase import IndirectCitationBase #------------------------------------------------------------------------- # # Source class # #------------------------------------------------------------------------- -class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject): +class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, + PrimaryObject): """A record of a source of information.""" def __init__(self): diff --git a/gramps/gen/merge/mergecitationquery.py b/gramps/gen/merge/mergecitationquery.py index fba082e8b..79cd0a216 100644 --- a/gramps/gen/merge/mergecitationquery.py +++ b/gramps/gen/merge/mergecitationquery.py @@ -31,7 +31,7 @@ Provide merge capabilities for citations. # #------------------------------------------------------------------------- from ..lib import (Person, Family, Event, Place, - MediaObject, Repository, Citation) + MediaObject, Repository, Citation, Source) from ..db import DbTxn from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext @@ -101,6 +101,12 @@ class MergeCitationQuery(object): citation.replace_citation_references(old_handle, new_handle) self.database.commit_citation(citation, trans) + elif class_name == Source.__name__: + source = self.database.get_source_from_handle(handle) + assert(source.has_citation_reference(old_handle)) + source.replace_citation_references(old_handle, + new_handle) + self.database.commit_source(source, trans) else: raise MergeError("Encounter an object of type %s that has " "a citation reference." % class_name)