| |
- convertBooleanStringToBoolean(val=None)
- convertBooleanStringToBoolean - Convert from a boolean attribute (string "true" / "false" ) into a booelan
- convertPossibleValues(val, possibleValues, invalidDefault, emptyValue='')
- convertPossibleValues - Convert input value to one of several possible values,
with a default for invalid entries
@param val <None/str> - The input value
@param possibleValues list<str> - A list of possible values
@param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None
and "val" is not in #possibleValues
If instantiated Exception (like ValueError('blah')): Raise this exception
If an Exception type ( like ValueError ) - Instantiate and raise this exception type
Otherwise, use this raw value
@param emptyValue Default '', used for an empty value (empty string or None)
- convertToBooleanString(val=None)
- convertToBooleanString - Converts a value to either a string of "true" or "false"
@param val <int/str/bool> - Value
- convertToIntOrNegativeOneIfUnset(val=None)
- convertToIntOrNegativeOneIfUnset - Converts value to an integer, or -1 if unset
@param val <int/str/None> - Value
Takes a value, if not set returns -1. If not an integer, returns 0
- convertToIntRange(val, minValue, maxValue, invalidDefault, emptyValue='')
- converToIntRange - Convert input value to an integer within a certain range
@param val <None/str/int/float> - The input value
@param minValue <None/int> - The minimum value (inclusive), or None if no minimum
@param maxValue <None/int> - The maximum value (inclusive), or None if no maximum
@param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None
and "val" is not in #possibleValues
If instantiated Exception (like ValueError('blah')): Raise this exception
If an Exception type ( like ValueError ) - Instantiate and raise this exception type
Otherwise, use this raw value
@param emptyValue Default '', used for an empty value (empty string or None)
- convertToIntRangeCapped(val, minValue, maxValue, invalidDefault, emptyValue='')
- converToIntRangeCapped - Convert input value to an integer within a certain range, capping the value potentially at a minimum or maximum
@param val <None/str/int/float> - The input value
@param minValue <None/int> - The minimum value (inclusive), or None if no minimum
@param maxValue <None/int> - The maximum value (inclusive), or None if no maximum
@param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None
and "val" is not in #possibleValues
If instantiated Exception (like ValueError('blah')): Raise this exception
If an Exception type ( like ValueError ) - Instantiate and raise this exception type
Otherwise, use this raw value
@param emptyValue Default '', used for an empty value (empty string or None)
|