# HG changeset patch # User Mads Kiilerich # Date 2020-02-04 03:25:17 # Node ID b4095011433dbf6db164b327cd93faf01f807e8e # Parent c59e914c48873e8aef16e7a4ebdd97a16e9c0320 py3: fix auth_crowd str/bytes handling diff --git a/kallithea/lib/auth_modules/auth_crowd.py b/kallithea/lib/auth_modules/auth_crowd.py --- a/kallithea/lib/auth_modules/auth_crowd.py +++ b/kallithea/lib/auth_modules/auth_crowd.py @@ -32,7 +32,7 @@ import urllib2 from kallithea.lib import auth_modules, ext_json from kallithea.lib.compat import formatted_json, hybrid_property -from kallithea.lib.utils2 import ascii_bytes +from kallithea.lib.utils2 import ascii_bytes, ascii_str, safe_bytes log = logging.getLogger(__name__) @@ -83,7 +83,7 @@ class CrowdServer(object): _headers = {"Content-type": "application/json", "Accept": "application/json"} if self.user and self.passwd: - authstring = base64.b64encode("%s:%s" % (self.user, self.passwd)) + authstring = ascii_str(base64.b64encode(safe_bytes("%s:%s" % (self.user, self.passwd)))) _headers["Authorization"] = "Basic %s" % authstring if headers: _headers.update(headers)