web/application.py
changeset 8609 112a04c0473d
parent 8594 001159e2e4f3
parent 8602 d066ba3bb07d
child 8694 d901c36bcfce
--- a/web/application.py	Fri Nov 16 11:53:17 2012 +0100
+++ b/web/application.py	Mon Dec 03 00:03:03 2012 +0100
@@ -34,7 +34,8 @@
 
 from cubicweb import set_log_methods, cwvreg
 from cubicweb import (
-    ValidationError, Unauthorized, AuthenticationError, NoSelectableObject,
+    ValidationError, Unauthorized, Forbidden,
+    AuthenticationError, NoSelectableObject,
     BadConnectionId, CW_EVENT_MANAGER)
 from cubicweb.dbapi import DBAPISession, anonymous_session
 from cubicweb.web import LOGGER, component
@@ -469,6 +470,11 @@
                                        'If you think you should, please contact the site administrator.')
             req.status_out = httplib.UNAUTHORIZED
             result = self.error_handler(req, ex, tb=False)
+        except Forbidden, ex:
+            req.data['errmsg'] = req._('This action is forbidden. '
+                                       'If you think it should be allowed, please contact the site administrator.')
+            req.status_out = httplib.FORBIDDEN
+            result = self.error_handler(req, ex, tb=False)
         except (BadRQLQuery, RequestError), ex:
             result = self.error_handler(req, ex, tb=False)
         ### pass through exception