decorators.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:website 作者: hackerspace-ntnu 项目源码 文件源码
def response_forbidden(request, article, urlpath):
    if request.user.is_anonymous():
        qs = request.META.get('QUERY_STRING', '')
        if qs:
            qs = urlquote('?' + qs)
        else:
            qs = ''
        return redirect(settings.LOGIN_URL + "?next=" + request.path + qs)
    else:
        return HttpResponseForbidden(
            render_to_string(
                "wiki/permission_denied.html",
                context={'article': article,
                         'urlpath': urlpath},
                request=request))


# TODO: This decorator is too complex (C901)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号