From a9b7b43ffbe8240fb656c1a12a5be44e20c1f4b7 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 17 May 2015 19:01:21 -0400 Subject: [PATCH] DictionaryDb: give handle in bytes, handle as str internally in dict --- gramps/plugins/database/dictionarydb.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gramps/plugins/database/dictionarydb.py b/gramps/plugins/database/dictionarydb.py index 549732b34..2eda2460d 100644 --- a/gramps/plugins/database/dictionarydb.py +++ b/gramps/plugins/database/dictionarydb.py @@ -735,60 +735,80 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): return self.tag_map.keys() def get_event_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") event = None if handle in self.event_map: event = Event.create(self.event_map[handle]) return event def get_family_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") family = None if handle in self.family_map: family = Family.create(self.family_map[handle]) return family def get_repository_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") repository = None if handle in self.repository_map: repository = Repository.create(self.repository_map[handle]) return repository def get_person_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") person = None if handle in self.person_map: person = Person.create(self.person_map[handle]) return person def get_place_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") place = None if handle in self.place_map: place = Place.create(self.place_map[handle]) return place def get_citation_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") citation = None if handle in self.citation_map: citation = Citation.create(self.citation_map[handle]) return citation def get_source_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") source = None if handle in self.source_map: source = Source.create(self.source_map[handle]) return source def get_note_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") note = None if handle in self.note_map: note = Note.create(self.note_map[handle]) return note def get_object_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") media = None if handle in self.media_map: media = MediaObject.create(self.media_map[handle]) return media def get_tag_from_handle(self, handle): + if isinstance(handle, bytes): + handle = str(handle, "utf-8") tag = None if handle in self.tag_map: tag = Tag.create(self.tag_map[handle])