]> git.openstreetmap.org Git - osqa.git/commitdiff
Don't allow negative points awards.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 16 May 2011 11:54:27 +0000 (11:54 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 16 May 2011 11:54:27 +0000 (11:54 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1038 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/commands.py

index f34619a4c1437db21f4597b2f40cb5524daf758e..630e0ef88842547da78263a5d45cab05f7f900c0 100644 (file)
@@ -583,6 +583,9 @@ def award_points(request, user_id, answer_id):
         points = int(request.POST['points'])
 
         # We should check if the user has enough reputation points, otherwise we raise an exception.
+        if points < 0:
+            raise CommandException(_("The number of points to award needs to be a positive value."))
+
         if user.reputation < points:
             raise NotEnoughRepPointsException(_("award"))