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


Python Validator.validators方法代码示例

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


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

示例1: test_email

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validators [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

示例2: test_net

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validators [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

示例3: import_orders

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validators [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

示例4: vars

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validators [as 别名]
                    action='store_true',
                    default=False,
                    required=False)

args = parser.parse_args()

# file:///usr/share/doc/python-lxml-doc/html/xpathxslt.html

if args.info:
    print Validator.desc_of_validator(args.info)
    workdir.rmdir()
    sys.exit(0)
    
if args.list_validators:
    print "seznam validaci:\n\t",
    print "\n\t".join(Validator.validators())
    workdir.rmdir()
    sys.exit(0)


root_logger = logging.getLogger()

if args.verbose:
    root_logger.setLevel(logging.INFO)
if args.debug:
    root_logger.setLevel(logging.DEBUG)

# print vars(args)
# sys.exit(1)

# logger.debug("pracovni adresar je: " + str(workdir))
开发者ID:edeposit,项目名称:psp-validator,代码行数:33,代码来源:validate-psp.py

示例5: get_info

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validators [as 别名]
sys.path.append(os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'lib','python2.7'))
sys.path.append(os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'etc'))

from validator import Validator

def get_info(v):
    result = Validator.desc_of_validator(v)
    lines = [ l.strip() for l in  re.split("[\ \t]*\n[\ \t]*",result,re.MULTILINE) ]
    return {
        'validator': v,
        'short': lines[0],
        'desc': lines[1:]
        }

available_validators = Validator.validators()
# print Validator.desc_of_validator(available_validators[0])
# print [ str(get_info(v)) for v in available_validators ]
infos = [ get_info(v) for v in available_validators ]

widths = {
    'validator': max([len(i['validator']) for i in infos]),
    'short': max([len(i['short']) for i in infos]),
    'desc': max([len(i['short']) for i in infos]),
    }

format_line = "| {:<%d} | {:<%d} | {:<%d} |" % (widths['validator'],
                                                widths['short'],
                                                widths['desc'])

format_line = "| {:<%d} | {:<%d} | {:<%d} |" % (widths['validator'],
开发者ID:edeposit,项目名称:psp-validator,代码行数:32,代码来源:validations-summary.py


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