fix error from fix encoding issue for python 3
svn: r21070
This commit is contained in:
parent
976dd620a2
commit
d9c1a330f3
@ -102,6 +102,17 @@ DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
|
|||||||
# Helper functions
|
# Helper functions
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
def find_byte_surname(key, data):
|
||||||
|
"""
|
||||||
|
Creating a surname from raw data of a person, to use for sort and index
|
||||||
|
returns a byte string
|
||||||
|
"""
|
||||||
|
surn = __index_surname(data[3][5])
|
||||||
|
# in python 3 we work with unicode internally, but need byte function sometimes
|
||||||
|
if isinstance(surn, UNITYPE):
|
||||||
|
return surn.encode('utf-8')
|
||||||
|
return surn
|
||||||
|
|
||||||
def find_surname(key, data):
|
def find_surname(key, data):
|
||||||
"""
|
"""
|
||||||
Creating a surname from raw data of a person, to use for sort and index
|
Creating a surname from raw data of a person, to use for sort and index
|
||||||
|
@ -74,7 +74,7 @@ from ..lib.researcher import Researcher
|
|||||||
from . import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
from . import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
||||||
DbTxn, BsddbBaseCursor, BsddbDowngradeError, DbVersionError,
|
DbTxn, BsddbBaseCursor, BsddbDowngradeError, DbVersionError,
|
||||||
DbEnvironmentError, DbUpgradeRequiredError, find_surname,
|
DbEnvironmentError, DbUpgradeRequiredError, find_surname,
|
||||||
find_surname_name, DbUndoBSDDB as DbUndo)
|
find_byte_surname, find_surname_name, DbUndoBSDDB as DbUndo)
|
||||||
from .dbconst import *
|
from .dbconst import *
|
||||||
from ..utils.callback import Callback
|
from ..utils.callback import Callback
|
||||||
from ..utils.cast import (conv_unicode_tosrtkey, conv_dbstr_to_unicode)
|
from ..utils.cast import (conv_unicode_tosrtkey, conv_dbstr_to_unicode)
|
||||||
@ -718,7 +718,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
if not self.readonly:
|
if not self.readonly:
|
||||||
|
|
||||||
assoc = [
|
assoc = [
|
||||||
(self.person_map, self.surnames, find_surname),
|
(self.person_map, self.surnames, find_byte_surname),
|
||||||
(self.person_map, self.id_trans, find_idmap),
|
(self.person_map, self.id_trans, find_idmap),
|
||||||
(self.family_map, self.fid_trans, find_idmap),
|
(self.family_map, self.fid_trans, find_idmap),
|
||||||
(self.event_map, self.eid_trans, find_idmap),
|
(self.event_map, self.eid_trans, find_idmap),
|
||||||
|
Loading…
Reference in New Issue
Block a user