예제 #1
0
    class FieldsSchema(validators.Schema):
        chained_validators = [validators.FieldsMatch('passwd', 'passwd2')]

        name = validators.UnicodeString()
        age = validators.Int()
        passwd = validators.NotEmpty()
        passwd2 = validators.UnicodeString()
예제 #2
0
class UserEditSchema(validators.Schema):
    """
    separate validation schema from the fields definition
    make it possible to define a more complex schema
    that involves field dependency or logical operators
    """
    user_name = validators.String(not_empty=True, max=16)
    status = validators.OneOf(['ENABLED', 'LOCKED', 'DISABLED'])
    password = validators.UnicodeString(max=50)
    password_confirm = validators.UnicodeString(max=50)
    chained_validators = [
        validators.FieldsMatch('password', 'password_confirm')
    ]
예제 #3
0
 class FieldsSchema(validators.Schema):
     chained_validators = [validators.FieldsMatch('passwd', 'passwd2')]