本文整理汇总了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])
示例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])
示例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')