rest.py 文件源码

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

项目:aide 作者: Lambda-3 项目源码 文件源码
def handle_result(result, rsc):
    logdebug(result)
    if result or result == []:
        try:
            return marshal(result, rsc.marshal_with(), rsc.envelope())
        except AttributeError as e:
            if "'NoneType' object has no attribute 'items'" in str(e):
                loginfo(e)
                try:
                    result = to_dict(result)
                    loginfo(result)
                    return marshal(result, rsc.marshal_with(), rsc.envelope())
                except AttributeError as e:
                    if isinstance(result, dict):
                        logdebug("result is already dict")
                        return result
                    else:
                        loginfo(str(e))
                        return {rsc.envelope(): result}

            else:
                raise AttributeError(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号