]> git.openstreetmap.org Git - osqa.git/commitdiff
#OSQA-388, we check if the user has enough reputation points (if the amount of points...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 16 Mar 2011 15:51:06 +0000 (15:51 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 16 Mar 2011 15:51:06 +0000 (15:51 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@855 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/commands.py

index 0708f631d5d2f6beff6e114983919e419a3f3501..f7d91aefd89e60b56942699dd0e5734c5f7cc27b 100644 (file)
@@ -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