Class: ErrorSet
Exception for failed translation of user input.
Instances serve as containers mapping errors to the fields to which they apply. An error may be either a simple error message string, or it may be another ErrorSet instance in the case of nested errors.
Each error (be it a message or an ErrorSet object) is associated with an iterable of zero or more field names, which is called the target. While the same error may be mapped to more than target, an error may be mapped to the same target only once. The order in which field names are given is insignificant.
Methods
add (self, error, target=None)
Associate an error with the given iterable of target field names. Ignore the order of the field names.
errors (self)
Return all errors that have been added to the collection.
errors_for (self, target)
Return a set of errors that have been assigned to target, an iterable of field names whose order is insignificant. Raise KeyError if no errors have been assigned.
has_partial_target (self, target)
Return whether the given iterable of field names forms an improper subset of any target.
has_target (self, target)
Return whether an error has been assigned to the given iterable of field names.
iter_errors (self)
Iterate over the errors that have been added to the collection.
iter_targets (self)
Yield each target to which an error has been assigned.
sorted_targets (self, field_order)
Return the error set's targets sorted primarily by the number of fields in the target, and then by the position of the first field in each target list as indicated by field_order.
targets (self)
Return the set of targets to which errors have been assigned.
targets_for (self, error)
Return a set of targets to which error has been assigned. Raise KeyError if no such error has been added.
Attributes
args
Value of args
None
message
Value of message
None