diff options
author | NoahY <yuttadhammo@yahoo.com> | 2011-07-12 19:15:30 +0530 |
---|---|---|
committer | NoahY <yuttadhammo@yahoo.com> | 2011-07-12 19:15:30 +0530 |
commit | 6223685c7334df891b96991cce616b32f20944e2 (patch) | |
tree | 4557418ed6dc80638a62f35a692c84d6a87650a3 /askbot/auth.py | |
parent | 772f0af9c54256de64eb0d45eba6a2e49d4bcfac (diff) | |
download | askbot-6223685c7334df891b96991cce616b32f20944e2.tar.gz askbot-6223685c7334df891b96991cce616b32f20944e2.tar.bz2 askbot-6223685c7334df891b96991cce616b32f20944e2.zip |
added answer own question limitations and accept own answer capability.
Diffstat (limited to 'askbot/auth.py')
-rw-r--r-- | askbot/auth.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/askbot/auth.py b/askbot/auth.py index 83821ff3..e9a93ec5 100644 --- a/askbot/auth.py +++ b/askbot/auth.py @@ -109,18 +109,18 @@ def onAnswerAccept(answer, user, timestamp=None): answer.question.answer_accepted = True answer.save() answer.question.save() - - answer.author.receive_reputation( - askbot_settings.REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE - ) - answer.author.save() - reputation = Repute(user=answer.author, - positive=askbot_settings.REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE, - question=answer.question, - reputed_at=timestamp, - reputation_type=2, - reputation=answer.author.reputation) - reputation.save() + if answer.author != user: + answer.author.receive_reputation( + askbot_settings.REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE + ) + answer.author.save() + reputation = Repute(user=answer.author, + positive=askbot_settings.REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE, + question=answer.question, + reputed_at=timestamp, + reputation_type=2, + reputation=answer.author.reputation) + reputation.save() user.receive_reputation(askbot_settings.REP_GAIN_FOR_ACCEPTING_ANSWER) user.save() |