Use Unauthorized exception for access checks.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Fri, 04 Feb 2011 16:37:56 +0530
changeset 557 a8102f88008c
parent 556 a0e57ca7cf56
child 558 fd3e6f5f01bd
Use Unauthorized exception for access checks.
pytask/taskapp/views/task.py
--- a/pytask/taskapp/views/task.py	Fri Feb 04 16:37:22 2011 +0530
+++ b/pytask/taskapp/views/task.py	Fri Feb 04 16:37:56 2011 +0530
@@ -45,6 +45,9 @@
 NO_EDIT_RIGHT = ugettext(
   "You are not authorized to edit this page.")
 
+NO_MOD_REVIEWERS_RIGHT = ugettext(
+  "You are not authorized to moderate reviewers.")
+
 
 @login_required
 def create_task(request):
@@ -377,7 +380,7 @@
         can_mod_reviewers = False
 
     if not can_mod_reviewers:
-        raise http.Http404
+        raise exceptions.UnauthorizedAccess(NO_MOD_REVIEWERS_RIGHT)
 
     context = {
       'user': user,