The get_name_group_mapping method should return a str

Fixes #10084, #10085, #10086.
This commit is contained in:
Nick Hall 2017-06-23 18:15:04 +01:00
parent 7d9556c933
commit fd329764ed
2 changed files with 6 additions and 3 deletions

View File

@ -917,8 +917,11 @@ class DbBsddbRead(DbReadBase, Callback):
Return the default grouping name for a surname. Return the default grouping name for a surname.
Return type is a unicode object Return type is a unicode object
""" """
key = surname.encode('utf-8') group = self.name_group.get(surname.encode('utf-8'))
return self.name_group.get(key, surname) if group is not None:
return group.decode('utf-8')
else:
return surname
def get_name_group_keys(self): def get_name_group_keys(self):
""" """

View File

@ -1640,7 +1640,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
if data is not None: if data is not None:
txn.delete(sname) txn.delete(sname)
if group is not None: if group is not None:
txn.put(sname, group) txn.put(sname, group.encode('utf-8'))
if group is None: if group is None:
grouppar = '' grouppar = ''
else: else: