def cancel(self): """cancel the vote while taking into account whether vote was up or down return change in score on the post """ #importing locally because of circular dependency from askbot import auth score_before = self.voted_post.points if self.vote > 0: # cancel upvote auth.onUpVotedCanceled(self, self.voted_post, self.user) else: # cancel downvote auth.onDownVotedCanceled(self, self.voted_post, self.user) score_after = self.voted_post.points return score_after - score_before