api.py 文件源码

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

项目:weasyl 作者: Weasyl 项目源码 文件源码
def api_login_required(view_callable):
    """
    Like decorators.login_required, but returning json on an error.
    """
    # TODO: If we replace the regular @login_required checks on POSTs with a tween, what do about this?
    def inner(request):
        if request.userid == 0:
            raise HTTPUnauthorized(
                json=_ERROR_UNSIGNED,
                www_authenticate=_STANDARD_WWW_AUTHENTICATE,
            )
        return view_callable(request)
    return inner
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号