class ConfigSet(validators.Schema): '''Set of validators for the set method of Configs''' # pylint: disable-msg=W0232,R0903 username = KnownUser application = validators.All(validators.UnicodeString, validators.Regex(regex='^[a-z0-9-_]+$'), # This could also match the db precisely. But then we'd have to # keep them synced: #validators.OneOf(('asterisk', 'moin', 'myfedora', 'openid', # 'bugzilla')) ) attribute = validators.UnicodeString value = validators.UnicodeString
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()
class InputFieldsSchema(validators.Schema): # Regex validator ensures only certain characters are input, essentially alphanumeric with new lines and spaces peptide = validators.All( accesionOrSeq(), validators.String(min=3), validators.Regex( r'^[^\x00-\x09\x0B-\x0C\x0E-\x1F\x21-\x2F\x3A-\x3C\x3F-\x40\x5B-\x5E\x60\x7B\x7D-\x7F]*$' )) enzyme = validators.OneOf([ "Chymotrypsin", "Chymotrypsin Low Specificity", "Trypsin", "Pepsin (ph = 1.3)", "Pepsin (ph >= 2.0)" ]) misses = validators.Int(if_empty=0, min=0, max=50) minlen = validators.Int(if_empty=0, min=0) maxlen = validators.Int(if_empty=1000000000, min=0) minweight = validators.Int(if_empty=500, min=0) maxweight = validators.Int(if_empty=1000000000, min=0)