Remove conv_dbstr_to_unicode function
This commit is contained in:
parent
8dffe6639b
commit
e813e1c5c2
@ -41,10 +41,6 @@ LOG = logging.getLogger(".")
|
||||
#-------------------------------------------------------------------------
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ..constfunc import conv_to_unicode
|
||||
|
||||
#strings in database are utf-8
|
||||
conv_dbstr_to_unicode = lambda x: conv_to_unicode(x, 'UTF-8')
|
||||
|
||||
def cast_to_bool(val):
|
||||
return val in ['True', 'true', _('True'), _('true'), '1'] # 3139
|
||||
|
@ -68,7 +68,6 @@ from gramps.gen.lib.researcher import Researcher
|
||||
from gramps.gen.lib.nameorigintype import NameOriginType
|
||||
|
||||
from gramps.gen.utils.callback import Callback
|
||||
from gramps.gen.utils.cast import conv_dbstr_to_unicode
|
||||
from . import BsddbBaseCursor
|
||||
from gramps.gen.db.base import DbReadBase
|
||||
from gramps.gen.utils.id import create_id
|
||||
@ -916,14 +915,16 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
Return type is a unicode object
|
||||
"""
|
||||
if isinstance(surname, str):
|
||||
surname = surname.encode('utf-8')
|
||||
return conv_dbstr_to_unicode(self.name_group.get(surname, surname))
|
||||
key = surname.encode('utf-8')
|
||||
else:
|
||||
key = surname
|
||||
return self.name_group.get(key, surname)
|
||||
|
||||
def get_name_group_keys(self):
|
||||
"""
|
||||
Return the defined names that have been assigned to a default grouping.
|
||||
"""
|
||||
return list(map(conv_dbstr_to_unicode, list(self.name_group.keys())))
|
||||
return [ng.decode('utf-8') for ng in self.name_group.keys()]
|
||||
|
||||
def has_name_group_key(self, name):
|
||||
"""
|
||||
|
@ -72,7 +72,6 @@ from . import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
||||
from gramps.gen.db import exceptions
|
||||
from gramps.gen.db.dbconst import *
|
||||
from gramps.gen.utils.callback import Callback
|
||||
from gramps.gen.utils.cast import conv_dbstr_to_unicode
|
||||
from gramps.gen.utils.id import create_id
|
||||
from gramps.gen.updatecallback import UpdateCallback
|
||||
from gramps.gen.errors import DbError
|
||||
@ -1797,9 +1796,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
This is a list of unicode objects, which are decoded from the utf-8 in
|
||||
bsddb
|
||||
"""
|
||||
#TODO GTK3: Why double conversion? Convert to a list of str objects!
|
||||
self.surname_list = sorted(
|
||||
map(conv_dbstr_to_unicode, set(self.surnames.keys())),
|
||||
[s.decode('utf-8') for s in self.surnames.keys()],
|
||||
key=glocale.sort_key)
|
||||
|
||||
def add_to_surname_list(self, person, batch_transaction):
|
||||
|
Loading…
x
Reference in New Issue
Block a user