From 8058fe3f8e019699a3032c1e8e7d02015c7e2612 Mon Sep 17 00:00:00 2001 From: jordan Date: Wed, 16 Mar 2011 15:51:06 +0000 Subject: [PATCH] #OSQA-388, we check if the user has enough reputation points (if the amount of points the user is trying to give is less than the user's reputation). git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@855 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/views/commands.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forum/views/commands.py b/forum/views/commands.py index 0708f63..f7d91ae 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -570,6 +570,10 @@ def award_points(request, user_id, answer_id): else: points = int(request.POST['points']) + # We should check if the user has enough reputation points, otherwise we raise an exception. + if user.reputation < points: + raise NotEnoughRepPointsException(_("award")) + extra = dict(message=request.POST.get('message', ''), awarding_user=request.user.id, value=points) # We take points from the awarding user -- 2.39.5