From 1b7fc0bc414537629ca79be2a48b2d9ea0a57000 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 19 Apr 2014 16:56:46 +0200 Subject: Handling PermissionDenied Exception. --- pyaggr3g470r/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index d23a7693..c50e2b45 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -95,8 +95,8 @@ def authentication_required(e): @app.errorhandler(403) def authentication_failed(e): - flash('Authentication failed.', 'danger') - return redirect(url_for('login')), 403 + flash('Forbidden.', 'danger') + return redirect(url_for('login')) @app.errorhandler(404) def page_not_found(e): @@ -610,7 +610,7 @@ def dashboard(): @app.route('/admin/create_user/', methods=['GET', 'POST']) @app.route('/admin/edit_user//', methods=['GET', 'POST']) @login_required -@admin_permission.require() +@admin_permission.require(http_exception=403) def create_user(user_id=None): """ Create or edit a user. @@ -654,7 +654,7 @@ def create_user(user_id=None): @app.route('/admin/user//', methods=['GET']) @login_required -@admin_permission.require() +@admin_permission.require(http_exception=403) def user(user_id=None): """ See information about a user (stations, etc.). @@ -668,7 +668,7 @@ def user(user_id=None): @app.route('/admin/delete_user//', methods=['GET']) @login_required -@admin_permission.require() +@admin_permission.require(http_exception=403) def delete_user(user_id=None): """ Delete a user (with its stations and measures). -- cgit