From bc3bbe2fbe12b590eff30ff5b5e5af2f66ee2885 Mon Sep 17 00:00:00 2001 From: hernani Date: Mon, 16 May 2011 11:54:27 +0000 Subject: [PATCH] Don't allow negative points awards. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1038 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/views/commands.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forum/views/commands.py b/forum/views/commands.py index f34619a..630e0ef 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -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")) -- 2.39.5