wsgi.py 文件源码

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

项目:vdi-broker 作者: cloudbase 项目源码 文件源码
def validate_string_length(value, entity_name, min_length=0,
                               max_length=None, remove_whitespaces=False):
        """Check the length of specified string.

        :param value: the value of the string
        :param entity_name: the name of the string
        :param min_length: the min_length of the string
        :param max_length: the max_length of the string
        :param remove_whitespaces: True if trimming whitespaces is needed
                                   else False
        """
        if isinstance(value, six.string_types) and remove_whitespaces:
            value = value.strip()
        try:
            _check_string_length(value, entity_name,
                                 min_length=min_length,
                                 max_length=max_length)
        except exception.InvalidInput as error:
            raise webob.exc.HTTPBadRequest(explanation=error.msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号