# HG changeset patch # User Mads Kiilerich # Date 2016-01-05 16:30:12 # Node ID 8eebcf50fdd5b56eae26291aec2d27c6cf0dbf45 # Parent 13da890538532ecc99a5be124dc2f465196e4bf6 auth: get username as str when container auth gets username from user object Avoid stray unicode username. diff --git a/kallithea/lib/auth_modules/auth_container.py b/kallithea/lib/auth_modules/auth_container.py --- a/kallithea/lib/auth_modules/auth_container.py +++ b/kallithea/lib/auth_modules/auth_container.py @@ -27,7 +27,7 @@ Original author and date, and relevant c import logging from kallithea.lib import auth_modules -from kallithea.lib.utils2 import str2bool, safe_unicode +from kallithea.lib.utils2 import str2bool, safe_unicode, safe_str from kallithea.lib.compat import hybrid_property from kallithea.model.db import User, Setting @@ -182,7 +182,7 @@ class KallitheaAuthPlugin(auth_modules.K # only way to log in is using environ username = None if userobj: - username = getattr(userobj, 'username') + username = safe_str(getattr(userobj, 'username')) if not username: # we don't have any objects in DB, user doesn't exist, extract