Module: check_mk
Branch: master
Commit: b82354b948fedd9a2f331a20a840001192be7743
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b82354b948fedd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jul 17 18:28:55 2012 +0200
New option prefix_values for ValueSpec DropdownChoice
---
web/htdocs/valuespec.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 0de2dc7..4c85365 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -757,6 +757,7 @@ class DropdownChoice(ValueSpec):
self._choices = kwargs["choices"]
self._help_separator = kwargs.get("help_separator")
self._label = kwargs.get("label")
+ self._prefix_values = kwargs.get("prefix_values", False)
def choices(self):
if type(self._choices) == list:
@@ -778,6 +779,8 @@ class DropdownChoice(ValueSpec):
defval = "0"
options = []
for n, entry in enumerate(self.choices()):
+ if self._prefix_values:
+ entry = (entry[0], "%s - %s" % entry)
options.append((str(n),) + entry[1:])
if entry[0] == value:
defval = str(n)