From: hernani Date: Mon, 16 May 2011 11:54:27 +0000 (+0000) Subject: Don't allow negative points awards. X-Git-Tag: live~275 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/bc3bbe2fbe12b590eff30ff5b5e5af2f66ee2885 Don't allow negative points awards. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1038 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- 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"))