exceptions.py 文件源码

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

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def message(self):
        if (self.legacy and has_request_context() and g.get('api_version') and
                g.api_version == API_VERSIONS.v1):
            return self.details  # legacy for v1: return dict in message
        if getattr(self, 'error_message', None) is not None:
            return self.error_message  # raise ValidateError('error message')
        if self.details:  # raise ValidateError(details={'smth': 'wrong'})
            return u'Invalid data: {0}'.format(
                json.dumps(self.details, ensure_ascii=False))
        return u'Invalid data'  # raise ValidateError()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号