diff --git a/kallithea/controllers/api/api.py b/kallithea/controllers/api/api.py --- a/kallithea/controllers/api/api.py +++ b/kallithea/controllers/api/api.py @@ -898,7 +898,7 @@ class ApiController(JSONRPCController): try: ugm = UserGroupModel().add_user_to_group(user_group, user) - success = True if ugm != True else False + success = True if ugm is not True else False msg = 'added member `%s` to user group `%s`' % ( user.username, user_group.users_group_name ) diff --git a/kallithea/lib/recaptcha.py b/kallithea/lib/recaptcha.py --- a/kallithea/lib/recaptcha.py +++ b/kallithea/lib/recaptcha.py @@ -51,7 +51,7 @@ def submit(g_recaptcha_response, private if not (isinstance(return_values, dict)): return RecaptchaResponse(is_valid=False, error_code='incorrect-captcha-sol') - elif (("success" in return_values) and ((return_values["success"] == True) or (return_values["success"] == "true"))): + elif (("success" in return_values) and ((return_values["success"] is True) or (return_values["success"] == "true"))): return RecaptchaResponse(is_valid=True) elif (("error-codes" in return_values) and isinstance(return_values["error-codes"], list) and (len(return_values["error-codes"]) > 0)): return RecaptchaResponse(is_valid=False, error_code=return_values["error-codes"][0]) diff --git a/kallithea/model/user_group.py b/kallithea/model/user_group.py --- a/kallithea/model/user_group.py +++ b/kallithea/model/user_group.py @@ -166,6 +166,7 @@ class UserGroupModel(object): raise def add_user_to_group(self, user_group, user): + """Return True if user already is in the group - else return the new UserGroupMember""" user_group = UserGroup.guess_instance(user_group) user = User.guess_instance(user)