##// END OF EJS Templates
auth-crawd: py3 compat
dan -
r4350:365337eb default
parent child Browse files
Show More
@@ -153,25 +153,25 b' class CrowdServer(object):'
153 global msg
153 global msg
154 msg = ""
154 msg = ""
155 try:
155 try:
156 rdoc = self.opener.open(request)
156 ret_doc = self.opener.open(request)
157 msg = "".join(rdoc.readlines())
157 msg = ret_doc.read()
158 if not msg and empty_response_ok:
158 if not msg and empty_response_ok:
159 rval = {}
159 ret_val = {}
160 rval["status"] = True
160 ret_val["status"] = True
161 rval["error"] = "Response body was empty"
161 ret_val["error"] = "Response body was empty"
162 elif not noformat:
162 elif not noformat:
163 rval = json.loads(msg)
163 ret_val = json.loads(msg)
164 rval["status"] = True
164 ret_val["status"] = True
165 else:
165 else:
166 rval = "".join(rdoc.readlines())
166 ret_val = msg
167 except Exception as e:
167 except Exception as e:
168 if not noformat:
168 if not noformat:
169 rval = {"status": False,
169 ret_val = {"status": False,
170 "body": body,
170 "body": body,
171 "error": str(e) + "\n" + msg}
171 "error": "{}\n{}".format(e, msg)}
172 else:
172 else:
173 rval = None
173 ret_val = None
174 return rval
174 return ret_val
175
175
176 def user_auth(self, username, password):
176 def user_auth(self, username, password):
177 """Authenticate a user against crowd. Returns brief information about
177 """Authenticate a user against crowd. Returns brief information about
General Comments 0
You need to be logged in to leave comments. Login now