reqparse.py 文件源码

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

项目:Chorus 作者: DonaldBough 项目源码 文件源码
def handle_validation_error(self, error, bundle_errors):
        """Called when an error is raised while parsing. Aborts the request
        with a 400 status and an error message

        :param error: the error that was raised
        :param bundle_errors: do not abort when first error occurs, return a
            dict with the name of the argument and the error message to be
            bundled
        """
        error_str = six.text_type(error)
        error_msg = self.help.format(error_msg=error_str) if self.help else error_str
        msg = {self.name: "{0}".format(error_msg)}

        if current_app.config.get("BUNDLE_ERRORS", False) or bundle_errors:
            return error, msg
        flask_restful.abort(400, message=msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号