exceptionhandler.py 文件源码

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

项目:BrewCenterAPI 作者: BrewCenter 项目源码 文件源码
def custom_exception_handler(exc, context):
    # if its a view with a list and request attr
    if 'view' in context and hasattr(context['view'], 'list') and hasattr(context['view'], 'request'):
        view = context['view']
        request = view.request

        if request.method == 'GET' and settings.ENABLE_UNAUTHENTICATED_RESULTS and isinstance(exc, NotAuthenticated):
            return view.list(context['request'])

    return exception_handler(exc, context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号