factor out double handle2internal

svn: r21126
This commit is contained in:
Benny Malengier 2013-01-15 08:49:08 +00:00
parent bb392985f0
commit ca287ac12e

View File

@ -53,7 +53,7 @@ from ..ggettext import gettext as _
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from ..constfunc import conv_to_unicode from ..constfunc import conv_to_unicode, handle2internal
from .dbconst import * from .dbconst import *
from . import BSDDBTxn from . import BSDDBTxn
from ..errors import DbError from ..errors import DbError
@ -69,17 +69,6 @@ DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
_SIGBASE = ('person', 'family', 'source', 'event', 'media', _SIGBASE = ('person', 'family', 'source', 'event', 'media',
'place', 'repository', 'reference', 'note', 'tag', 'citation') 'place', 'repository', 'reference', 'note', 'tag', 'citation')
#-------------------------------------------------------------------------
#
# Helper functions
#
#-------------------------------------------------------------------------
# handle in database is bytes, while internally Gramps wants unicode for py3
if sys.version_info[0] < 3:
handle2internal = lambda x: x
else:
handle2internal = lambda x: conv_to_unicode(x, 'utf-8')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# DbUndo class # DbUndo class