当前位置: 首页>>代码示例>>Python>>正文


Python Validator.prohibited_states方法代码示例

本文整理汇总了Python中validator.Validator.prohibited_states方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.prohibited_states方法的具体用法?Python Validator.prohibited_states怎么用?Python Validator.prohibited_states使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validator.Validator的用法示例。


在下文中一共展示了Validator.prohibited_states方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_net

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import prohibited_states [as 别名]
 def test_net(self):
     csvfile = open('/home/clyde/lot18/net_test.csv')
     v = Validator(csvfile)
     v.validators = ['ny_net']
     v.prohibited_states = prohibited_states
     r = v()
     csvfile.close()
     self.assertTrue([i['valid'] for i in r][0])
开发者ID:amalgamatedclyde,项目名称:acme_wine,代码行数:10,代码来源:validator-test.py

示例2: test_email

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import prohibited_states [as 别名]
 def test_email(self):
     csvfile = open('/home/clyde/lot18/email_test.csv')
     v = Validator(csvfile)
     v.validators = ['email']
     v.prohibited_states = prohibited_states
     r = v()
     csvfile.close()
     self.assertEqual([False,True,False], [i['valid'] for i in r])
开发者ID:amalgamatedclyde,项目名称:acme_wine,代码行数:10,代码来源:validator-test.py

示例3: import_orders

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import prohibited_states [as 别名]
def import_orders():
    if request.method == 'GET':
        return render_template('import_orders.html')
    if request.method == 'POST' and request.files['file']:
        orders = request.files['file']
        if not orders.filename.endswith('.csv'):
            return 'Please select a valid csv file'
        v = Validator(orders)
        v.prohibited_states = prohibited_states
        v.validators = validators
        validated_records = v()
        result = save2mongo(validated_records)
        if result:
            return 'your orders have been succesfully posted'
        elif not result:
            return 'there has been a problem uploading your order'
    else:
        return  render_template('import_orders.html')
开发者ID:amalgamatedclyde,项目名称:acme_wine,代码行数:20,代码来源:Acme+Wine.py


注:本文中的validator.Validator.prohibited_states方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。