From 0937ed89a1187cfcc503fa22576d946a23758546 Mon Sep 17 00:00:00 2001 From: Daniel Dourvaris Date: Wed, 20 May 2020 10:44:04 +0200 Subject: [PATCH] auth-crawd: py3 compat --- .../authentication/plugins/auth_crowd.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rhodecode/authentication/plugins/auth_crowd.py b/rhodecode/authentication/plugins/auth_crowd.py index b47be971..0817db4e 100644 --- a/rhodecode/authentication/plugins/auth_crowd.py +++ b/rhodecode/authentication/plugins/auth_crowd.py @@ -153,25 +153,25 @@ class CrowdServer(object): global msg msg = "" try: - rdoc = self.opener.open(request) - msg = "".join(rdoc.readlines()) + ret_doc = self.opener.open(request) + msg = ret_doc.read() if not msg and empty_response_ok: - rval = {} - rval["status"] = True - rval["error"] = "Response body was empty" + ret_val = {} + ret_val["status"] = True + ret_val["error"] = "Response body was empty" elif not noformat: - rval = json.loads(msg) - rval["status"] = True + ret_val = json.loads(msg) + ret_val["status"] = True else: - rval = "".join(rdoc.readlines()) + ret_val = msg except Exception as e: if not noformat: - rval = {"status": False, - "body": body, - "error": str(e) + "\n" + msg} + ret_val = {"status": False, + "body": body, + "error": "{}\n{}".format(e, msg)} else: - rval = None - return rval + ret_val = None + return ret_val def user_auth(self, username, password): """Authenticate a user against crowd. Returns brief information about