do not display password in error

This commit is contained in:
egarette@silique.fr 2025-10-05 20:41:00 +02:00
parent aa774cbce9
commit c56cdcfa02

View file

@ -364,10 +364,17 @@ class ValueOptionError(_CommonError, ValueError):
def __init__(self, **kwargs):
if ValueOptionError.tmpl is None:
if kwargs.get("index") is None:
self.tmpl = _('"{0}" is an invalid {1} for {2}')
opt = kwargs.get('opt')
if opt and opt._do_not_display_value_in_error:
if kwargs.get("index") is None:
self.tmpl = _('{2} has an invalid {1}')
else:
self.tmpl = _('{2} at index "{3}" has an invalid {1}')
else:
self.tmpl = _('"{0}" is an invalid {1} for {2} at index "{3}"')
if kwargs.get("index") is None:
self.tmpl = _('"{0}" is an invalid {1} for {2}')
else:
self.tmpl = _('"{0}" is an invalid {1} for {2} at index "{3}"')
super().__init__(**kwargs)