@csrf_exempt
@ratelimit('answer-vote', '10/d')
def answer_vote(request, question_id, answer_id):
    """Vote for Helpful/Not Helpful answers"""
    answer = get_object_or_404(Answer, pk=answer_id, question=question_id,
                               is_spam=False, question__is_spam=False)

    if not answer.question.editable:
        raise PermissionDenied

    if request.limited:
        if request.is_ajax():
            return HttpResponse(json.dumps({'ignored': True}))
        else:
            return HttpResponseRedirect(answer.get_absolute_url())

    if not answer.has_voted(request):
        vote = AnswerVote(answer=answer)

        if request.REQUEST in 'helpful':
            vote.helpful = True
            message = _('Glad to hear it!')
        else:
            message = _('Sorry to hear that.')

        if request.user.is_authenticated():
            vote.creator = request.user
        else:
            vote.anonymous_id = request.anonymous.anonymous_id

        vote.save()

        if 'referrer' in request.REQUEST:
            referrer = request.REQUEST.get('referrer')
            vote.add_metadata('referrer', referrer)

            if referrer == 'search' and 'query' in request.REQUEST:
                vote.add_metadata('query', request.REQUEST.get('query'))

        ua = request.META.get('HTTP_USER_AGENT')
        if ua:
            vote.add_metadata('ua', ua)
        statsd.incr('questions.votes.answer')
    else:
        message = _('You already voted on this reply.')

    if request.is_ajax():
        return HttpResponse(json.dumps({'message': message}))

    return HttpResponseRedirect(answer.get_absolute_url())
dataset/ETHPy150Open mozilla/kitsune/kitsune/questions/views.py/answer_vote/swapped operands of `in`