From c56cdcfa024914e3c75ee378b062e3378f0bf1c5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 5 Oct 2025 20:41:00 +0200 Subject: [PATCH] do not display password in error --- tiramisu/error.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tiramisu/error.py b/tiramisu/error.py index 22155ae..d5ff19e 100644 --- a/tiramisu/error.py +++ b/tiramisu/error.py @@ -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)