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
评论列表
文章目录