RuleStrNotNullEmptyWs Class
- class kwhelp.rules.RuleStrNotNullEmptyWs(key: str, name: str, value: object, raise_errors: bool, originator: object)[source]
Bases:
kwhelp.rules.RuleStrNotNullOrEmpty
Rule that matched only if value is not
None
, empty or whitespace.- __init__(key: str, name: str, value: object, raise_errors: bool, originator: object)
Constructor
- Parameters
key (str) – the key that rule is to apply to.
name (str) – the name of the field that value was assigned
value (object) – the value that is assigned to
field_name
raise_errors (bool) – determinins if rule could raise an error when validation fails
originator (object) – the object that attributes validated for
- Raises
TypeError – If any arg is not of the correct type
- validate() bool [source]
Validates that value to assign is a string and is not a empty or whitespace string.
- Raises
ValueError – If
raise_errors
isTrue
andfield_value
is not instance of string or is empty or whitespace string- Returns
True
if value is valid; Otherwise;False
.- Return type
bool
- property field_name: str
Name of the field assigned.
- Getter
Gets the name of the field assigned
- Setter
Sets the name of the field assigned
- property field_value: object
The value assigned to
field_name
- Getter
Gets value assigned to
field_name
- Setter
Sets value assigned to
field_name
- property key: str
Gets the key currently being read
- property originator: object
Gets object that attributes validated for
- property raise_errors: bool
Determines if a rule can raise an error when validation fails.
- Getter
Gets if a rule could raise an error when validation fails
- Setter
Sets if a rule could raise an error when validation fails