From 01582db9e67a6c495195e2dd373458b79eebdf8f Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Wed, 24 Jul 2013 15:41:29 -0700 Subject: [PATCH] Move CHEATER error into a flag. --- r2/r2/controllers/api.py | 10 ++++------ r2/r2/lib/errors.py | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 2021ac2d3..37a17483c 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -421,8 +421,7 @@ class ApiController(RedditController, OAuth2ResourceController): l._commit() l.set_url_cache() - queries.queue_vote(c.user, l, True, ip, - cheater = (errors.CHEATER, None) in c.errors) + queries.queue_vote(c.user, l, True, ip, cheater=c.cheater) if save: r = l._save(c.user) @@ -1358,8 +1357,7 @@ class ApiController(RedditController, OAuth2ResourceController): else: item, inbox_rel = Comment._new(c.user, link, parent_comment, comment, ip) - queries.queue_vote(c.user, item, True, ip, - cheater = (errors.CHEATER, None) in c.errors) + queries.queue_vote(c.user, item, True, ip, cheater=c.cheater) # adding to comments-tree is done as part of # newcomments_q, so if they refresh immediately they @@ -1542,7 +1540,7 @@ class ApiController(RedditController, OAuth2ResourceController): queries.queue_vote(user, thing, dir, ip, vote_info=vote_info, store=store, - cheater = (errors.CHEATER, None) in c.errors) + cheater=c.cheater) @require_oauth2_scope("modconfig") @validatedForm(VUser(), @@ -2437,7 +2435,7 @@ class ApiController(RedditController, OAuth2ResourceController): for link in links: queries.queue_vote(c.user, link, action == 'like', request.ip, - cheater = (errors.CHEATER, None) in c.errors) + cheater=c.cheater) elif action == 'save': link = max(links, key = lambda x: x._score) r = link._save(c.user) diff --git a/r2/r2/lib/errors.py b/r2/r2/lib/errors.py index d87f037c9..ec9b43e4e 100644 --- a/r2/r2/lib/errors.py +++ b/r2/r2/lib/errors.py @@ -75,7 +75,6 @@ error_list = dict(( ('BAD_CNAME', "that domain isn't going to work"), ('USED_CNAME', "that domain is already in use"), ('INVALID_OPTION', _('that option is not valid')), - ('CHEATER', 'what do you think you\'re doing there?'), ('BAD_EMAILS', _('the following emails are invalid: %(emails)s')), ('NO_EMAILS', _('please enter at least one email address')), ('TOO_MANY_EMAILS', _('please only share to %(num)s emails at a time.')),