From 92f435d45b15be2a758c387b1206d42cc6a91a5f Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 17 May 2015 11:38:31 -0400 Subject: [PATCH] Diff: fixed import of DictionaryDb; removed mistaken tag.gramps_id references in DictionartDb --- gramps/gen/merge/diff.py | 2 +- gramps/plugins/database/dictionarydb.py | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/gramps/gen/merge/diff.py b/gramps/gen/merge/diff.py index 67539a0bb..a0d4bebad 100644 --- a/gramps/gen/merge/diff.py +++ b/gramps/gen/merge/diff.py @@ -28,7 +28,7 @@ from gramps.cli.user import User from ..dbstate import DbState from gramps.cli.grampscli import CLIManager from ..plug import BasePluginManager -from ..db.dictionary import DictionaryDb +from gramps.plugins.database.dictionarydb import DictionaryDb from gramps.gen.lib.handle import HandleClass, Handle from gramps.gen.lib import * from gramps.gen.lib.personref import PersonRef diff --git a/gramps/plugins/database/dictionarydb.py b/gramps/plugins/database/dictionarydb.py index 878afa880..549732b34 100644 --- a/gramps/plugins/database/dictionarydb.py +++ b/gramps/plugins/database/dictionarydb.py @@ -402,7 +402,6 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): self.event_map = Map(Table(self._tables["Event"])) self.event_id_map = {} self.tag_map = Map(Table(self._tables["Tag"])) - self.tag_id_map = {} self.metadata = Map(Table({"cursor_func": lambda: MetaCursor()})) self.name_group = {} self.undo_callback = None @@ -867,11 +866,6 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): return Note.create(self.note_id_map[gramps_id]) return None - def get_tag_from_gramps_id(self, gramps_id): - if gramps_id in self.tag_id_map: - return Tag.create(self.tag_id_map[gramps_id]) - return None - def get_number_of_people(self): return len(self.person_map) @@ -1238,7 +1232,6 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): else: emit = "tag-add" self.tag_map[tag.handle] = tag.serialize() - self.tag_id_map[tag.gramps_id] = self.tag_map[tag.handle] # Emit after added: if emit: self.emit(emit, ([tag.handle],)) @@ -1423,7 +1416,7 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): database, preserving the change in the passed transaction. """ self.__do_remove(handle, transaction, self.tag_map, - self.tag_id_map, TAG_KEY) + None, TAG_KEY) def is_empty(self): """ @@ -1440,7 +1433,8 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): if handle in data_map: obj = self._tables[KEY_TO_CLASS_MAP[key]]["class_func"].create(data_map[handle]) del data_map[handle] - del data_id_map[obj.gramps_id] + if data_id_map: + del data_id_map[obj.gramps_id] self.emit(KEY_TO_NAME_MAP[key] + "-delete", ([handle],)) def delete_primary_from_reference_map(self, handle, transaction, txn=None):