pyinthesky.validators¶
-
class
Validator
(validator, ident_string, output_wrapper=None)[source]¶ Bases:
object
-
exception
Invalid
(msg, value, state, error_list=None, error_dict=None)¶ Bases:
Exception
This is raised in response to invalid input. It has several public attributes:
msg
:- The message, without values substituted. For instance, if you want HTML quoting of values, you can apply that.
substituteArgs
:- The arguments (a dictionary) to go with
msg
. str(self)
:- The message describing the error, with values substituted.
value
:- The offending (invalid) value.
state
:- The state that went with this validator. This is an application-specific object.
error_list
:- If this was a compound validator that takes a repeating value, and sub-validator(s) had errors, then this is a list of those exceptions. The list will be the same length as the number of values – valid values will have None instead of an exception.
error_dict
:- Like
error_list
, but for dictionary compound validators.
-
unpack_errors
(encode_variables=False, dict_char='.', list_char='-')¶ Returns the error as a simple data structure – lists, dictionaries, and strings.
If
encode_variables
is true, then this will return a flat dictionary, encoded with variable_encode
-
exception