From 919484683e1aca3d0ce72296244d0ee2ba460b1b Mon Sep 17 00:00:00 2001 From: Hugo Levy-Falk Date: Thu, 5 Sep 2019 19:16:37 +0200 Subject: [PATCH] Do not fail on ACL with unauthenticated users. --- re2o/acl.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/re2o/acl.py b/re2o/acl.py index 116d273b..59b09716 100644 --- a/re2o/acl.py +++ b/re2o/acl.py @@ -158,10 +158,15 @@ ModelC) messages.error( request, msg or _("You don't have the right to access" " this menu.")) - return redirect(reverse( - 'users:profil', - kwargs={'userid': str(request.user.id)} - )) + if request.user.id is not None: + return redirect(reverse( + 'users:profil', + kwargs={'userid': str(request.user.id)} + )) + else: + return redirect(reverse( + 'index', + )) return view(request, *chain(instances, args), **kwargs) return wrapper return decorator