Module: check_mk
Branch: master
Commit: ae6c21b81016324b8b36e056ea72aacf2f02d90e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ae6c21b8101632…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 5 17:19:20 2017 +0200
Improved error handling during displaying of global settings values
Change-Id: Iddc2ef99bd968047e3ac102464252332f754efa9
---
web/htdocs/wato.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c95a0bf..ff3620b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6827,11 +6827,17 @@ class ModeGlobalSettings(WatoMode):
html.strip_tags(help_text), title_text))
if varname in self._current_settings:
- to_text = valuespec.value_to_text(self._current_settings[varname])
+ value = self._current_settings[varname]
elif varname in self._global_settings:
- to_text = valuespec.value_to_text(self._global_settings[varname])
+ value = self._global_settings[varname]
else:
- to_text = valuespec.value_to_text(default_value)
+ value = default_value
+
+ try:
+ to_text = valuespec.value_to_text(value)
+ except Exception, e:
+ log_exception()
+ to_text = html.render_error(_("Failed to render value: %r")
% value)
# Is this a simple (single) value or not? change styling in these
cases...
simple = True
@@ -6840,15 +6846,12 @@ class ModeGlobalSettings(WatoMode):
forms.section(title, simple=simple)
if varname in self._current_settings:
- value = self._current_settings[varname]
modified_cls = "modified"
title = _("This option has been modified.")
elif varname in self._global_settings:
- value = self._global_settings[varname]
modified_cls = "modified globally"
title = _("This option has been modified in global
settings.")
else:
- value = default_value
modified_cls = None
title = None