Mercurial > kallithea
changeset 7815:72c4b2d720ea
flake8: fix some E712 comparison to True should be 'if cond is True:' or 'if cond:'
add_user_to_group is really odd ...
Note that the SqlAlchemy query API cause a lot of this kind of warnings.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 04 Aug 2019 00:59:42 +0200 |
parents | f0e8d673f2a2 |
children | c1aff621ed54 |
files | kallithea/controllers/api/api.py kallithea/lib/recaptcha.py kallithea/model/user_group.py |
diffstat | 3 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/api/api.py Sat Aug 03 23:31:43 2019 +0200 +++ b/kallithea/controllers/api/api.py Sun Aug 04 00:59:42 2019 +0200 @@ -898,7 +898,7 @@ 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 )
--- a/kallithea/lib/recaptcha.py Sat Aug 03 23:31:43 2019 +0200 +++ b/kallithea/lib/recaptcha.py Sun Aug 04 00:59:42 2019 +0200 @@ -51,7 +51,7 @@ 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])
--- a/kallithea/model/user_group.py Sat Aug 03 23:31:43 2019 +0200 +++ b/kallithea/model/user_group.py Sun Aug 04 00:59:42 2019 +0200 @@ -166,6 +166,7 @@ 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)