Remove handle2internal function

This commit is contained in:
Nick Hall 2015-12-05 18:14:16 +00:00
parent e813e1c5c2
commit 5d7343f10a
9 changed files with 73 additions and 101 deletions

View File

@ -45,17 +45,6 @@ LINUX = ["Linux", "linux", "linux2"]
MACOS = ["Darwin", "darwin"]
WINDOWS = ["Windows", "win32"]
#-------------------------------------------------------------------------
#
# Public Functions
#
#-------------------------------------------------------------------------
def conv_to_unicode(x, y='utf8'):
return x if x is None or isinstance(x, str) else str(x, y) if y else str(x)
# handle in database is bytes, while internally Gramps wants unicode for py3
handle2internal = lambda x: conv_to_unicode(x, 'utf-8')
#-------------------------------------------------------------------------
#
# Platform determination functions

View File

@ -34,7 +34,6 @@ from gramps.gen.lib import *
from gramps.gen.lib.personref import PersonRef
from gramps.gen.lib.eventref import EventRef
from ..const import GRAMPS_LOCALE as glocale
from ..constfunc import handle2internal
_ = glocale.translation.gettext
def get_schema(cls):
@ -277,8 +276,8 @@ def diff_dbs(db1, db2, user=None):
for item in ['Person', 'Family', 'Source', 'Citation', 'Event', 'Media',
'Place', 'Repository', 'Note', 'Tag']:
step()
handles1 = sorted([handle2internal(handle) for handle in db1._tables[item]["handles_func"]()])
handles2 = sorted([handle2internal(handle) for handle in db2._tables[item]["handles_func"]()])
handles1 = sorted([handle.decode('utf-8') for handle in db1._tables[item]["handles_func"]()])
handles2 = sorted([handle.decode('utf-8') for handle in db2._tables[item]["handles_func"]()])
p1 = 0
p2 = 0
while p1 < len(handles1) and p2 < len(handles2):

View File

@ -72,7 +72,7 @@ from . import BsddbBaseCursor
from gramps.gen.db.base import DbReadBase
from gramps.gen.utils.id import create_id
from gramps.gen.errors import DbError
from gramps.gen.constfunc import handle2internal, get_env_var
from gramps.gen.constfunc import get_env_var
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
@ -1020,8 +1020,7 @@ class DbBsddbRead(DbReadBase, Callback):
""" return all the keys of a database table
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
return table.keys(txn=self.txn)
@ -1033,8 +1032,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by surnames.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
handle_list = self.all_handles(self.person_map)
@ -1051,8 +1049,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by Place title.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
@ -1070,8 +1067,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by Source title.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
handle_list = self.all_handles(self.source_map)
@ -1088,8 +1084,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by Citation Volume/Page.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
handle_list = self.all_handles(self.citation_map)
@ -1106,8 +1101,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by title.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
handle_list = self.all_handles(self.media_map)
@ -1122,8 +1116,7 @@ class DbBsddbRead(DbReadBase, Callback):
database.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
return self.all_handles(self.event_map)
@ -1135,8 +1128,7 @@ class DbBsddbRead(DbReadBase, Callback):
the database.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
return self.all_handles(self.family_map)
@ -1148,8 +1140,7 @@ class DbBsddbRead(DbReadBase, Callback):
the database.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
return self.all_handles(self.repository_map)
@ -1161,8 +1152,7 @@ class DbBsddbRead(DbReadBase, Callback):
database.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
return self.all_handles(self.note_map)
@ -1176,8 +1166,7 @@ class DbBsddbRead(DbReadBase, Callback):
If sort_handles is True, the list is sorted by Tag name.
.. warning:: For speed the keys are directly returned, so on python3
bytestrings are returned! Use constfunc.py handle2internal
on this result!
bytestrings are returned!
"""
if self.db_is_open:
handle_list = self.all_handles(self.tag_map)
@ -1193,7 +1182,7 @@ class DbBsddbRead(DbReadBase, Callback):
def g(self):
with curs_(self) as cursor:
for key, data in cursor:
yield handle2internal(key)
yield key.decode('utf-8')
return g
# Use closure to define iterators for each primary object type

View File

@ -51,7 +51,6 @@ _ = glocale.translation.gettext
# Gramps modules
#
#-------------------------------------------------------------------------
from gramps.gen.constfunc import handle2internal
from gramps.gen.db.dbconst import *
from . import BSDDBTxn
from gramps.gen.errors import DbError
@ -315,7 +314,7 @@ class DbUndo(object):
"""
try:
if data is None:
emit(signal_root + '-delete', ([handle2internal(handle)],))
emit(signal_root + '-delete', ([handle.decode('utf-8')],))
db_map.delete(handle, txn=self.txn)
else:
ex_data = db_map.get(handle, txn=self.txn)
@ -324,7 +323,7 @@ class DbUndo(object):
else:
signal = signal_root + '-add'
db_map.put(handle, data, txn=self.txn)
emit(signal, ([handle2internal(handle)],))
emit(signal, ([handle.decode('utf-8')],))
except DBERRS as msg:
self.db._log_error()

View File

@ -41,7 +41,6 @@ from bsddb3 import db
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import handle2internal
from gramps.gen.lib.markertype import MarkerType
from gramps.gen.lib.nameorigintype import NameOriginType
from gramps.gen.lib.eventtype import EventType
@ -197,7 +196,7 @@ def gramps_upgrade_17(self):
n -= 1
if parent_handle is not None:
placeref_list = [(handle2internal(parent_handle), None)]
placeref_list = [(parent_handle.decode('utf-8'), None)]
else:
placeref_list = []
@ -334,7 +333,7 @@ def add_place(self, name, level, parent, title):
gid = self.place_prefix % self.max_id
placetype = (7-level, '')
if parent is not None:
placeref_list = [(handle2internal(parent), None)]
placeref_list = [(parent.decode('utf-8'), None)]
else:
placeref_list = []
place = (handle, gid, title, '', '', placeref_list, name, [], placetype,

View File

@ -75,7 +75,7 @@ from gramps.gen.utils.callback import Callback
from gramps.gen.utils.id import create_id
from gramps.gen.updatecallback import UpdateCallback
from gramps.gen.errors import DbError
from gramps.gen.constfunc import win, handle2internal, get_env_var
from gramps.gen.constfunc import win, get_env_var
from gramps.gen.const import HOME_DIR, GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
@ -2209,10 +2209,10 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"""
if (obj_type, trans_type) in transaction:
if trans_type == TXNDEL:
handles = [handle2internal(handle) for handle, data in
handles = [handle.decode('utf-8') for handle, data in
transaction[(obj_type, trans_type)]]
else:
handles = [handle2internal(handle) for handle, data in
handles = [handle.decode('utf-8') for handle, data in
transaction[(obj_type, trans_type)]
if (handle, None) not in transaction[(obj_type,
TXNDEL)]]

View File

@ -28,7 +28,6 @@ Helper class for importing places.
#
#-------------------------------------------------------------------------
from gramps.gen.lib import Place, PlaceName, PlaceType, PlaceRef
from gramps.gen.constfunc import handle2internal
#-------------------------------------------------------------------------
#
@ -97,7 +96,7 @@ class PlaceImport(object):
if parent:
place = self.db.get_place_from_handle(handle)
placeref = PlaceRef()
placeref.ref = handle2internal(parent)
placeref.ref = parent.decode('utf-8')
place.set_placeref_list([placeref])
self.db.commit_place(place, trans, place.get_change_time())
@ -113,7 +112,7 @@ class PlaceImport(object):
place.place_type = PlaceType(7-type_num)
if parent is not None:
placeref = PlaceRef()
placeref.ref = handle2internal(parent)
placeref.ref = parent.decode('utf-8')
place.set_placeref_list([placeref])
handle = self.db.add_place(place, trans)
self.db.commit_place(place, trans)

View File

@ -71,7 +71,6 @@ from gramps.gui.plug import tool
from gramps.gui.dialog import OkDialog, MissingMediaDialog
from gramps.gen.display.name import displayer as _nd
from gramps.gui.glade import Glade
from gramps.gen.constfunc import handle2internal
# table for handling control chars in notes.
# All except 09, 0A, 0D are replaced with space.
@ -329,7 +328,7 @@ class CheckIntegrity(object):
previous_errors = len(self.duplicate_links)
for bhandle in self.db.person_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
value = self.db.person_map[bhandle]
p = Person(value)
splist = p.get_family_handle_list()
@ -352,7 +351,7 @@ class CheckIntegrity(object):
logging.info('Looking for character encoding errors')
error_count = 0
for bhandle in self.db.media_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
data = self.db.media_map[bhandle]
if not isinstance(data[2], str) or not isinstance(data[4], str):
obj = self.db.get_object_from_handle(handle)
@ -393,7 +392,7 @@ class CheckIntegrity(object):
logging.info('Looking for ctrl characters in notes')
error_count = 0
for bhandle in self.db.note_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
note = self.db.get_note_from_handle(handle)
stext = note.get_styledtext()
old_text = str(stext)
@ -421,7 +420,7 @@ class CheckIntegrity(object):
previous_errors = len(self.broken_parent_links + self.broken_links)
for bfamily_handle in fhandle_list:
family_handle = handle2internal(bfamily_handle)
family_handle = bfamily_handle.decode('utf-8')
family = self.db.get_family_from_handle(family_handle)
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
@ -546,7 +545,7 @@ class CheckIntegrity(object):
# Check persons membership in referenced families
for bperson_handle in self.db.get_person_handles():
person_handle = handle2internal(bperson_handle)
person_handle = bperson_handle.decode('utf-8')
person = self.db.get_person_from_handle(person_handle)
phandle_list = person.get_parent_family_handle_list()
@ -705,7 +704,7 @@ class CheckIntegrity(object):
#-------------------------------------------------------------------------
for bObjectId in self.db.get_media_object_handles():
ObjectId = handle2internal(bObjectId)
ObjectId = bObjectId.decode('utf-8')
obj = self.db.get_object_from_handle(ObjectId)
photo_name = media_path_full(self.db, obj.get_path())
photo_desc = obj.get_description()
@ -921,7 +920,7 @@ class CheckIntegrity(object):
logging.info('Looking for empty families')
previous_errors = len(self.empty_family)
for bfamily_handle in fhandle_list:
family_handle = handle2internal(bfamily_handle)
family_handle = bfamily_handle.decode('utf-8')
self.progress.step()
family = self.db.get_family_from_handle(family_handle)
@ -958,7 +957,7 @@ class CheckIntegrity(object):
previous_errors = len(self.fam_rel)
for bfamily_handle in fhandle_list:
family_handle = handle2internal(bfamily_handle)
family_handle = bfamily_handle.decode('utf-8')
self.progress.step()
family = self.db.get_family_from_handle(family_handle)
@ -996,7 +995,7 @@ class CheckIntegrity(object):
logging.info('Looking for event problems')
for bkey in self.db.get_person_handles(sort_handles=False):
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
person = self.db.get_person_from_handle(key)
@ -1114,7 +1113,7 @@ class CheckIntegrity(object):
self.invalid_events.add(key)
for bkey in self.db.get_family_handles():
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
family = self.db.get_family_from_handle(key)
if family.get_event_ref_list():
@ -1161,7 +1160,7 @@ class CheckIntegrity(object):
logging.info('Looking for person reference problems')
for bkey in plist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
none_handle = False
newlist = []
@ -1192,7 +1191,7 @@ class CheckIntegrity(object):
logging.info('Looking for family reference problems')
for bkey in plist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
person = self.db.get_person_from_handle(key)
for ordinance in person.get_lds_ord_list():
@ -1217,7 +1216,7 @@ class CheckIntegrity(object):
logging.info('Looking for repository reference problems')
for bkey in slist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
none_handle = False
newlist = []
@ -1250,7 +1249,7 @@ class CheckIntegrity(object):
logging.info('Looking for place reference problems')
for bkey in llist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
none_handle = False
newlist = []
@ -1278,7 +1277,7 @@ class CheckIntegrity(object):
# check persons -> the LdsOrd references a place
for bkey in plist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
person = self.db.get_person_from_handle(key)
for ordinance in person.lds_ord_list:
@ -1300,7 +1299,7 @@ class CheckIntegrity(object):
self.invalid_place_references.add(key)
# check families -> the LdsOrd references a place
for bkey in flist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
family = self.db.get_family_from_handle(key)
for ordinance in family.lds_ord_list:
@ -1320,7 +1319,7 @@ class CheckIntegrity(object):
self.invalid_place_references.add(key)
# check events
for bkey in elist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
event = self.db.get_event_from_handle(key)
place_handle = event.get_place_handle()
@ -1342,7 +1341,7 @@ class CheckIntegrity(object):
logging.info(' OK: no place reference problems found')
def check_citation_references(self):
known_handles = [handle2internal(key) for key in
known_handles = [key.decode('utf-8') for key in
self.db.get_citation_handles()]
total = (
@ -1361,7 +1360,7 @@ class CheckIntegrity(object):
logging.info('Looking for citation reference problems')
for bhandle in self.db.person_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.person_map[bhandle]
person = Person()
@ -1378,7 +1377,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.family_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.family_map[bhandle]
family = Family()
@ -1395,7 +1394,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.place_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.place_map[bhandle]
place = Place()
@ -1412,7 +1411,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.citation_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.citation_map[bhandle]
citation = Citation()
@ -1429,7 +1428,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.repository_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.repository_map[bhandle]
repository = Repository()
@ -1446,7 +1445,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.media_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.media_map[bhandle]
obj = MediaObject()
@ -1463,7 +1462,7 @@ class CheckIntegrity(object):
self.invalid_citation_references.add(item[1])
for bhandle in self.db.event_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.event_map[bhandle]
event = Event()
@ -1497,7 +1496,7 @@ class CheckIntegrity(object):
logging.info('Looking for source reference problems')
for bkey in clist:
key = handle2internal(bkey)
key = bkey.decode('utf-8')
self.progress.step()
citation = self.db.get_citation_from_handle(key)
source_handle = citation.get_reference_handle()
@ -1521,7 +1520,7 @@ class CheckIntegrity(object):
logging.info(' OK: no source reference problems found')
def check_media_references(self):
known_handles = [handle2internal(key) for key in
known_handles = [key.decode('utf-8') for key in
self.db.get_media_object_handles(False)]
total = (
@ -1538,7 +1537,7 @@ class CheckIntegrity(object):
logging.info('Looking for media object reference problems')
for bhandle in self.db.person_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.person_map[bhandle]
person = Person()
@ -1555,7 +1554,7 @@ class CheckIntegrity(object):
self.invalid_media_references.add(item[1])
for bhandle in self.db.family_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.family_map[bhandle]
family = Family()
@ -1572,7 +1571,7 @@ class CheckIntegrity(object):
self.invalid_media_references.add(item[1])
for bhandle in self.db.place_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.place_map[bhandle]
place = Place()
@ -1589,7 +1588,7 @@ class CheckIntegrity(object):
self.invalid_media_references.add(item[1])
for bhandle in self.db.event_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.event_map[bhandle]
event = Event()
@ -1606,7 +1605,7 @@ class CheckIntegrity(object):
self.invalid_media_references.add(item[1])
for bhandle in self.db.citation_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.citation_map[bhandle]
citation = Citation()
@ -1623,7 +1622,7 @@ class CheckIntegrity(object):
self.invalid_media_references.add(item[1])
for bhandle in self.db.source_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.source_map[bhandle]
source = Source()
@ -1661,7 +1660,7 @@ class CheckIntegrity(object):
if missing_references:
self.db.add_note(self.explanation, self.trans, set_gid=True)
known_handles = [handle2internal(key) for key in
known_handles = [key.decode('utf-8') for key in
self.db.get_note_handles()]
bad_handles = []
@ -1681,7 +1680,7 @@ class CheckIntegrity(object):
logging.info('Looking for note reference problems')
for bhandle in self.db.person_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.person_map[bhandle]
person = Person()
@ -1698,7 +1697,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.family_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.family_map[bhandle]
family = Family()
@ -1715,7 +1714,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.place_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.place_map[bhandle]
place = Place()
@ -1732,7 +1731,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.citation_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.citation_map[bhandle]
citation = Citation()
@ -1749,7 +1748,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.source_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.source_map[bhandle]
source = Source()
@ -1766,7 +1765,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.media_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.media_map[bhandle]
obj = MediaObject()
@ -1783,7 +1782,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.event_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.event_map[bhandle]
event = Event()
@ -1800,7 +1799,7 @@ class CheckIntegrity(object):
self.invalid_note_references.add(item[1])
for bhandle in self.db.repository_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.repository_map[bhandle]
repo = Repository()
@ -1831,7 +1830,7 @@ class CheckIntegrity(object):
len(self.db.get_media_object_handles()))
for bObjectId in self.db.get_media_object_handles():
self.progress.step()
ObjectId = handle2internal(bObjectId)
ObjectId = bObjectId.decode('utf-8')
obj = self.db.get_object_from_handle(ObjectId)
full_path = media_path_full(self.db, obj.get_path())
new_checksum = create_checksum(full_path)
@ -1841,7 +1840,7 @@ class CheckIntegrity(object):
self.db.commit_media_object(obj, self.trans)
def check_tag_references(self):
known_handles = [handle2internal(key) for key in
known_handles = [key.decode('utf-8') for key in
self.db.get_tag_handles()]
total = (
@ -1856,7 +1855,7 @@ class CheckIntegrity(object):
logging.info('Looking for tag reference problems')
for bhandle in self.db.person_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.person_map[bhandle]
person = Person()
@ -1873,7 +1872,7 @@ class CheckIntegrity(object):
self.invalid_tag_references.add(item[1])
for bhandle in self.db.family_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.family_map[bhandle]
family = Family()
@ -1890,7 +1889,7 @@ class CheckIntegrity(object):
self.invalid_tag_references.add(item[1])
for bhandle in self.db.media_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.media_map[bhandle]
obj = MediaObject()
@ -1907,7 +1906,7 @@ class CheckIntegrity(object):
self.invalid_tag_references.add(item[1])
for bhandle in self.db.note_map.keys():
handle = handle2internal(bhandle)
handle = bhandle.decode('utf-8')
self.progress.step()
info = self.db.note_map[bhandle]
note = Note()

View File

@ -30,7 +30,6 @@
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import handle2internal
#------------------------------------------------------------------------
#
@ -277,7 +276,7 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
fbh = db.find_backlink_handles
for handle, data in cursor:
if not any(h for h in fbh(handle)):
self.add_results((the_type, handle2internal(handle),
self.add_results((the_type, handle.decode('utf-8'),
data))
self.update()
self.reset()