Module: check_mk
Branch: master
Commit: 87f859ba7d974934aeb8678ecf46f64e32e32602
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=87f859ba7d9749…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 7 10:44:43 2014 +0200
Extract SingleInfoSelection into own function
---
web/htdocs/visuals.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 130b305..998b8ed 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -362,10 +362,7 @@ def page_create_visual(what, title, info_keys, next_url = None):
for key in info_keys:
info_choices.append((key, _('Show information of a single %s') %
infos[key]['title']))
- vs_infos = ListChoice(
- title = _('Specific objects'),
- choices = info_choices,
- )
+ vs_infos = SingleInfoSelection(info_keys)
html.header(_('Create %s') % title, stylesheets=["pages"])
html.begin_context_buttons()
@@ -972,6 +969,17 @@ class VisualFilter(ValueSpec):
def validate_value(self, value, varprefix):
ValueSpec.custom_validate(self, value, varprefix)
+
+def SingleInfoSelection(info_keys, **args):
+ info_choices = []
+ for key in info_keys:
+ info_choices.append((key, _('Show information of a single %s') %
infos[key]['title']))
+
+ args.setdefault("title", _('Specific objects'))
+ args["choices"] = info_choices
+ return ListChoice(**args)
+
+
#.
# .--Misc----------------------------------------------------------------.
# | __ __ _ |