import json
import threading
import time
-import six
import bcrypt
from .. import mgr, logger
from ..security import Scope, Permission
+from ..tools import ensure_str
from ..exceptions import RoleAlreadyExists, RoleDoesNotExist, ScopeNotValid, \
PermissionNotValid, RoleIsAssociatedWithUser, \
UserAlreadyExists, UserDoesNotExist, ScopeNotInRole, \
def password_hash(password, salt_password=None):
if not password:
return None
- if six.PY2:
- password = unicode(password, 'utf-8') if isinstance(password, str) else password
+ password = ensure_str(password)
if not salt_password:
salt_password = bcrypt.gensalt()
else: