def _add_boolean_validator(self, argument_name): bool_data_set = {} #the optional keyword if self.method_argument_dict[argument_name].has_key('optional'): if self.method_argument_dict[argument_name]['optional']: bool_data_set['not_empty'] = False else: bool_data_set['not_empty'] = True if bool_data_set: self.validator_list[argument_name] = validators.Bool( **bool_data_set) else: self.validator_list[argument_name] = validators.Bool()
class GroupSave(validators.Schema): groupname = validators.All(KnownGroup, validators.String(max=32, min=2)) display_name = validators.NotEmpty owner = KnownUser prerequisite = KnownGroup group_type = ValidGroupType invite_only = validators.Bool()
class GroupCreate(validators.Schema): name = validators.All( UnknownGroup, validators.UnicodeString(max=32, min=3), validators.Regex(regex='^[a-z0-9\-_]+$'), ) display_name = validators.NotEmpty owner = validators.All( KnownUser, validators.NotEmpty, ) prerequisite = KnownGroup group_type = ValidGroupType needs_sponsor = validators.Bool() user_can_remove = validators.Bool() invite_only = validators.Bool()
def __init__(self, *args, **kw): super(CheckBox, self).__init__(*args, **kw) if not self.validator: self.validator = validators.Bool()