askbot.views.commands

synopsis:most ajax processors for askbot

This module contains most (but not all) processors for Ajax requests. Not so clear if this subdivision was necessary as separation of Ajax and non-ajax views is not always very clean.

askbot.views.commands.ajax_command(request, *args, **kwargs)

view processing ajax commands - note “vote” and view others do it too

askbot.views.commands.ajax_toggle_ignored_questions(request, *args, **kwargs)
askbot.views.commands.close

view to initiate and process question close

askbot.views.commands.mark_tag(request, *args, **kwargs)
askbot.views.commands.process_vote(user=None, vote_direction=None, post=None)

function (non-view) that actually processes user votes - i.e. up- or down- votes

in the future this needs to be converted into a real view function for that url and javascript will need to be adjusted

also in the future make keys in response data be more meaningful right now they are kind of cryptic - “status”, “count”

askbot.views.commands.read_message(request)
askbot.views.commands.reopen

view to initiate and process question close

this is not an ajax view

askbot.views.commands.vote(request, id)

todo: this subroutine needs serious refactoring it’s too long and is hard to understand

vote_type:
acceptAnswer : 0, questionUpVote : 1, questionDownVote : 2, favorite : 4, answerUpVote: 5, answerDownVote:6, offensiveQuestion : 7, offensiveAnswer:8, removeQuestion: 9, removeAnswer:10 questionSubscribeUpdates:11 questionUnSubscribeUpdates:12
accept answer code:
response_data[‘allowed’] = -1, Accept his own answer 0, no allowed - Anonymous 1, Allowed - by default response_data[‘success’] = 0, failed 1, Success - by default response_data[‘status’] = 0, By default 1, Answer has been accepted already(Cancel)
vote code:
allowed = -3, Don’t have enough votes left

-2, Don’t have enough reputation score -1, Vote his own post

0, no allowed - Anonymous 1, Allowed - by default
status = 0, By default
1, Cancel 2, Vote is too old to be canceled
offensive code:
allowed = -3, Don’t have enough flags left
-2, Don’t have enough reputation score to do this
0, not allowed 1, allowed
status = 0, by default
1, can’t do it again

This Page