You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a custom dictionary class to safely skip substitution errors in ValidationError messages.
"%" substitution requires all keys to be matched during substitution, so if a ValidationError happens
to include a %(foo)s style variable not met by parameters, it will throw a KeyError. In Field.run_validators
there is also an accumulation of errors that are wrapped by a final ValidationError which can then
throw TypeError if any of the sub-errors contain replaceable substrings.
This patch implements a subclassed dict which simply returns the key's name for any missing keys. The end
result for the logic in exceptions.py is that the final message is an exact copy of the original message
with only found parameters replaced and the rest left untouched.
Signed-off-by: James Tanner <[email protected]>
0 commit comments