6960: Bless Source with an IndirectCitationBase

svn: r22970
This commit is contained in:
Vassilii Khachaturov 2013-08-30 22:33:58 +00:00
parent 94638ad84e
commit 64d3a217f1
2 changed files with 10 additions and 2 deletions

View File

@ -40,13 +40,15 @@ from .reporef import RepoRef
from .const import DIFFERENT, EQUAL, IDENTICAL from .const import DIFFERENT, EQUAL, IDENTICAL
from ..constfunc import cuni from ..constfunc import cuni
from .handle import Handle from .handle import Handle
from .citationbase import IndirectCitationBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Source class # Source class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject): class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
PrimaryObject):
"""A record of a source of information.""" """A record of a source of information."""
def __init__(self): def __init__(self):

View File

@ -31,7 +31,7 @@ Provide merge capabilities for citations.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from ..lib import (Person, Family, Event, Place, from ..lib import (Person, Family, Event, Place,
MediaObject, Repository, Citation) MediaObject, Repository, Citation, Source)
from ..db import DbTxn from ..db import DbTxn
from ..const import GRAMPS_LOCALE as glocale from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
@ -101,6 +101,12 @@ class MergeCitationQuery(object):
citation.replace_citation_references(old_handle, citation.replace_citation_references(old_handle,
new_handle) new_handle)
self.database.commit_citation(citation, trans) 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: else:
raise MergeError("Encounter an object of type %s that has " raise MergeError("Encounter an object of type %s that has "
"a citation reference." % class_name) "a citation reference." % class_name)