SelectionCheck limits the values that will validate.
SelectionCheck raises two exceptions:
NoSelectionError is raised if values is an empty list.
BadSelectionsError is raised if the values are not string or unicode objects.
values must be a list of strings.
If True, will validate despite the case of the item being validated.
If True, will allow the selection check to accept None
If used as an attribute with required=False, then allow_none will be True
ch = SelectionCheck('type', values=['fws', 'aide', 'volunteer'])
ch('FWS') # passes
ch('fws') # passes
ch('help') # fails
Parameters: |
|
---|
If values is an empty list, any text values will pass as long as the other attribute checks pass.
Calling a ListCheck object can have two keyword parameters.
Parameters: |
|
---|
The default values for normalize and as_string are both False.
There isn’t much difference between SelectionCheck and ListCheck. Future versions may combine them into one class. A ListCheck object is not much more than a SelectionCheck object that can read more than one item.
New in version 0.7.0: The callback parameter