def process_view(self, request, view_func, view_args, view_kwargs): from models import is_user_banned if hasattr(request, 'user'): if getattr(view_func, '_unbanned_user_requirement', None)\ and request.user.is_authenticated()\ and is_user_banned(request.user): ctx = {'ban': request.user.ban} return render_to_response('djangobb_forum/access_denied.html', RequestContext(request, ctx)) return None
def process_request(self, request): from models import is_user_banned path = request.path_info.lstrip('/') if not any(m.match(path) for m in forum_settings.BAN_EXEMPT_URLS): if hasattr(request, 'user'): if request.user.is_authenticated() and is_user_banned(request.user): ctx = {'ban': request.user.ban} return render_to_response('djangobb_forum/account_locked.html', RequestContext(request, ctx)) return None