Fix eptid key encoding for python 3

In python3 shelve wants strings for keys, but we were forcing bytes for
some reason.
This commit is contained in:
Clint Byrum 2015-05-24 08:00:59 -07:00
parent c2f95ccfbe
commit caa0eb8a00
2 changed files with 2 additions and 3 deletions

View File

@ -42,6 +42,8 @@ class Eptid(object):
return self._db[key]
def __setitem__(self, key, value):
if six.PY3 and isinstance(key, six.binary_type):
key = key.decode('utf-8')
self._db[key] = value
def get(self, idp, sp, *args):

View File

@ -111,9 +111,6 @@ class IdentDB(object):
:param ident: user identifier
:param name_id: NameID instance
"""
if isinstance(ident, six.string_types):
ident = ident.encode("utf-8")
# One user may have more than one NameID defined
try:
val = self.db[ident].split(" ")