def __init__(self,
                 validator,               # type: Validator
                 var_value,
                 var_name,                 # type: str
                 validation_outcome=None,  # type: Any
                 help_msg=None,            # type: str
                 append_details=True,      # type: bool
                 **kw_context_args):
        """
        Creates a ValidationError associated with validation of `var_value` using `validator`. Additional details
        about the `var_name` and `validation_outcome` (result or exception) can be provided. All of this
        information is stored in the exception object so as to be managed by a global error handler at application-level
        if needed (for example for internationalization purposes)

        :param validator: the Validator that raised this exception
        :param var_value: the value that was validated and failed validation
        :param var_name: the name associated to that value
        :param validation_outcome: the result of the validation process (either a non-True non-None value, or an
        exception)
        :param help_msg: an optional help message specific to this validation error. If not provided, the class
        attribute `help_msg` will be used. This behaviour may be redefined by subclasses by overriding `get_help_msg`
        :param append_details: a boolean indicating if a default message containing the value should be appended to the
        string representation. Default is True
        :param kw_context_args: optional context (results, other) to store in this failure and that will be also used
        for help message formatting
        """

        self.display_prefix_for_exc_outcomes = True

        self.append_details = append_details

        # store everything in self
        self.validator = validator
        self.var_value = var_value
        self.var_name = var_name
        self.validation_outcome = validation_outcome
        self.__dict__.update(kw_context_args)

        # store help_msg ONLY if non-None otherwise the possibly user-overridden class attribute should be left visible
        if help_msg is not None:
            self.help_msg = help_msg

        # call super constructor with nothing, since Exception does not accept keyword arguments and we are redefining
        # __str__ anyway
        super(ValidationError, self).__init__()

        # automatically set the exception as the cause, so that we can forget to "raise from" (except when from None)
        if isinstance(validation_outcome, Exception) and not should_be_hidden_as_cause(validation_outcome):
            self.__cause__ = validation_outcome
            # possibly hide the cause of the cause
            if hasattr(validation_outcome, '__cause__') and should_be_hidden_as_cause(validation_outcome.__cause__):
                validation_outcome.__cause__ = None
        else:
            self.__cause__ = None
def __init__ ( self , validator , var_value , var_name , validation_outcome = None , help_msg = None , append_details = True , ** kw_context_args ) : self . display_prefix_for_exc_outcomes = True self . append_details = append_details self . validator = validator self . var_value = var_value self . var_name = var_name self . validation_outcome = validation_outcome self . __dict__ . update ( kw_context_args ) if help_msg is not None : self . help_msg = help_msg super ( ValidationError , self ) . __init__ ( ) if isinstance ( validation_outcome , Exception ) and not should_be_hidden_as_cause ( validation_outcome ) : self . __cause__ = validation_outcome if hasattr ( validation_outcome , '__cause__' ) and should_be_hidden_as_cause ( validation_outcome . __cause__ ) : validation_outcome . __cause__ = None else : self . __cause__ = None
Creates a ValidationError associated with validation of `var_value` using `validator`. Additional details
        about the `var_name` and `validation_outcome` (result or exception) can be provided. All of this
        information is stored in the exception object so as to be managed by a global error handler at application-level
        if needed (for example for internationalization purposes)

        :param validator: the Validator that raised this exception
        :param var_value: the value that was validated and failed validation
        :param var_name: the name associated to that value
        :param validation_outcome: the result of the validation process (either a non-True non-None value, or an
        exception)
        :param help_msg: an optional help message specific to this validation error. If not provided, the class
        attribute `help_msg` will be used. This behaviour may be redefined by subclasses by overriding `get_help_msg`
        :param append_details: a boolean indicating if a default message containing the value should be appended to the
        string representation. Default is True
        :param kw_context_args: optional context (results, other) to store in this failure and that will be also used
        for help message formatting