changeset 5626:8eebcf50fdd5

auth: get username as str when container auth gets username from user object Avoid stray unicode username.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 05 Jan 2016 16:30:12 +0100
parents 13da89053853
children 6077644fca45
files kallithea/lib/auth_modules/auth_container.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/auth_modules/auth_container.py	Tue Jan 05 16:30:12 2016 +0100
+++ b/kallithea/lib/auth_modules/auth_container.py	Tue Jan 05 16:30:12 2016 +0100
@@ -27,7 +27,7 @@
 
 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 @@
         # 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