Module: check_mk
Branch: master
Commit: 583bad859be8ff8f40eed5f95dd1cb6f3bf6302f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=583bad859be8ff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 4 09:12:49 2017 +0200
Fixed additional problem with recently changed DropdownChoice() valuespec
Change-Id: I5878c1edbe6ea7f989d140b1da4533759e29dfb1
---
web/htdocs/valuespec.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index e4386ad..9d75665 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1601,15 +1601,18 @@ class DropdownChoice(ValueSpec):
self.classtype_info()
if self._label:
html.write("%s " % self._label)
- # Convert values from choices to keys
- defval = "0"
+
+ choices = self.choices()
+
+ defval = choices[0][0] if choices else None
options = []
- for n, entry in enumerate(self.choices()):
+ for entry in self.choices():
if self._prefix_values:
entry = (entry[0], "%s - %s" % entry)
- options.append((str(n),) + entry[1:])
+
+ options.append(entry)
if entry[0] == value:
- defval = str(n)
+ defval = entry[0]
# In complain mode: Use the value received from the HTML variable
if self._invalid_choice == "complain" and value != None and
self._value_is_invalid(value):