# HG changeset patch # User raph # Date 1279205669 -7200 # Node ID 730dd9fb2c770a8409aae61a3f221d7e11491925 # Parent b5deb8e32219ddcb1bb8274fe4200133937512ed simplification of security check: all unauthorized exceptions are dealt with by context processors diff -r b5deb8e32219 -r 730dd9fb2c77 src/cm/security.py --- a/src/cm/security.py Fri Jun 11 11:04:23 2010 +0200 +++ b/src/cm/security.py Thu Jul 15 16:54:29 2010 +0200 @@ -198,8 +198,7 @@ def _dec(view_func): def _check_global_perm(request, *args, **kwargs): if must_be_logged_in and not is_authenticated(request): - login_url = reverse('login') - return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, urlquote(request.get_full_path()))) + raise UnauthorizedException('Should be logged in') if has_perm(request, perm_name, text=None): return view_func(request, *args, **kwargs) @@ -222,8 +221,7 @@ return view_func(request, *args, **kwargs) if must_be_logged_in and not is_authenticated(request): - login_url = reverse('login') - return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, urlquote(request.get_full_path()))) + raise UnauthorizedException('Should be logged in') if 'key' in kwargs: text = get_object_or_404(Text, key=kwargs['key'])