[checkmk-commits] Check_MK Git: check_mk: Updated werk #1957 and improved handling of default values for text input fields

Sven Rueß sr at mathias-kettner.de
Fri Apr 17 12:19:43 CEST 2015


Module: check_mk
Branch: master
Commit: 4ca5cbd780e937c233594c55b26718baf8696c91
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ca5cbd780e937c233594c55b26718baf8696c91

Author: Sven Rueß <sr at mathias-kettner.de>
Date:   Fri Apr 17 12:18:14 2015 +0200

Updated werk #1957 and improved handling of default values for text input fields

---

 .werks/1957             |    6 +++---
 ChangeLog               |    2 +-
 web/htdocs/valuespec.py |    8 +++++++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.werks/1957 b/.werks/1957
index 49c70f8..6bd6b28 100644
--- a/.werks/1957
+++ b/.werks/1957
@@ -1,4 +1,4 @@
-Title: Fixed usage of default values in valuespec alternative selection
+Title: Fixed default value for text input fields in notification plugins
 Level: 1
 Component: multisite
 Class: fix
@@ -7,5 +7,5 @@ State: unknown
 Version: 1.2.7i1
 Date: 1429257630
 
-No default values were used in valuespec alternative selection.
-Now all default values are shown in subelements of alternative selection.
+No default values were used for text input fields in notification plugins.
+Other text input fields may also be affected.
diff --git a/ChangeLog b/ChangeLog
index e7b2e2d..b0b324e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -397,7 +397,7 @@
     * 2142 FIX: Fix non-working option for disabling column headers in grouped boxed views...
     * 2168 FIX: Fixed automation actions with transid=-1 when using basic authentication
     * 2177 FIX: Host/Service statistics dashlets honor the site filter correctly now
-    * 1957 FIX: Fixed usage of default values in valuespec alternative selection...
+    * 1957 FIX: Fixed default value for text input fields in notification plugins...
 
     WATO:
     * 1760 Added search form to manual checks page
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index cec47d9..5d4d190 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -2561,7 +2561,13 @@ class Alternative(ValueSpec):
         return self._elements[0].canonical_value()
 
     def default_value(self):
-        return self._elements[0].default_value()
+        try:
+            if type(self._default_value) == type(lambda:True):
+                return self._default_value()
+            else:
+                return self._default_value
+        except:
+            return self._elements[0].default_value()
 
     def value_to_text(self, value):
         vs = self.matching_alternative(value)



More information about the checkmk-commits mailing list