Look at functions onUpVoted, onDownVoted, onUpVotedCanceled and onDownVotedCanceled in askbot/auth.py (the functions may be moved and renamed in the future though).