diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-04-15 15:56:10 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-04-15 15:56:10 -0500 |
commit | c4b1d9152ecd66fdc89be21a819f70633235f551 (patch) | |
tree | 31d53764eb1516f4558f546b281f421222f171a8 /askbot/auth.py | |
parent | bb1a73f353ddfc15b31ad78e4778bd9bdc3abd22 (diff) | |
download | askbot-c4b1d9152ecd66fdc89be21a819f70633235f551.tar.gz askbot-c4b1d9152ecd66fdc89be21a819f70633235f551.tar.bz2 askbot-c4b1d9152ecd66fdc89be21a819f70633235f551.zip |
removed empty box on the registration page when login buttons are disabled
Diffstat (limited to 'askbot/auth.py')
-rw-r--r-- | askbot/auth.py | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/askbot/auth.py b/askbot/auth.py index 5c0f7bd9..eba24c80 100644 --- a/askbot/auth.py +++ b/askbot/auth.py @@ -199,6 +199,11 @@ def onAnswerAccept(answer, user, timestamp=None): reputation=answer.author.reputation) reputation.save() + if answer.author == question.author and user == question.author: + #a plug to prevent reputation gaming by posting a question + #then answering and accepting as best all by the same person + return + user.receive_reputation(askbot_settings.REP_GAIN_FOR_ACCEPTING_ANSWER) user.save() reputation = Repute(user=user, @@ -214,24 +219,29 @@ def onAnswerAcceptCanceled(answer, user, timestamp=None): if timestamp is None: timestamp = datetime.datetime.now() answer.thread.set_accepted_answer(answer=None, timestamp=None) - - answer.author.receive_reputation( - askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE - ) - answer.author.save() - question = answer.thread._question_post() - reputation = Repute( - user=answer.author, - negative=\ - askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE, - question=question, - reputed_at=timestamp, - reputation_type=-2, - reputation=answer.author.reputation - ) - reputation.save() + if user != answer.author: + answer.author.receive_reputation( + askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE + ) + answer.author.save() + reputation = Repute( + user=answer.author, + negative=\ + askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE, + question=question, + reputed_at=timestamp, + reputation_type=-2, + reputation=answer.author.reputation + ) + reputation.save() + + if answer.author == question.author and user == question.author: + #a symmettric measure for the reputation gaming plug + #as in the onAnswerAccept function + #here it protects the user from uwanted reputation loss + return user.receive_reputation( askbot_settings.REP_LOSS_FOR_CANCELING_ANSWER_ACCEPTANCE |