Module: check_mk
Branch: master
Commit: 03cf5134a47e03820b635b3f43fdc21f5c577cfc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=03cf5134a47e03…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Sep 4 12:00:38 2018 +0200
Removed dead parameter. Simplifications.
Change-Id: Id1ba3395854e0218aea4240ca83c66bcd849b18e
---
cmk/gui/views.py | 2 +-
cmk/gui/visuals.py | 24 ++++++++----------------
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/cmk/gui/views.py b/cmk/gui/views.py
index ff6b89d..b87e592 100644
--- a/cmk/gui/views.py
+++ b/cmk/gui/views.py
@@ -857,7 +857,7 @@ def show_view(view, show_heading = False, show_buttons = True,
#
# a) single context vars of the view are enforced
# b) multi context vars can be overwritten by existing HTML vars
- visuals.add_context_to_uri_vars(view, datasource["infos"], only_count)
+ visuals.add_context_to_uri_vars(view, only_count)
# Check that all needed information for configured single contexts are available
visuals.verify_single_contexts('views', view,
datasource.get('link_filters', {}))
diff --git a/cmk/gui/visuals.py b/cmk/gui/visuals.py
index 0cc0215..5b4c03d 100644
--- a/cmk/gui/visuals.py
+++ b/cmk/gui/visuals.py
@@ -1055,10 +1055,7 @@ def visible_filters_of_visual(visual, use_filters):
return show_filters
-def add_context_to_uri_vars(visual, only_infos=None, only_count=False):
- if only_infos == None:
- only_infos = infos.keys() # all datasources!
-
+def add_context_to_uri_vars(visual, only_count=False):
# Populate the HTML vars with missing context vars. The context vars set
# in single context are enforced (can not be overwritten by URL). The normal
# filter vars in "multiple" context are not enforced.
@@ -1067,19 +1064,14 @@ def add_context_to_uri_vars(visual, only_infos=None,
only_count=False):
html.set_var(key, "%s" % visual['context'][key])
# Now apply the multiple context filters
- for info_key in only_infos:
- for filter_vars in visual['context'].itervalues():
- if type(filter_vars) == dict: # this is a multi-context filter
- # We add the filter only if *none* of its HTML variables are present on
the URL
- # This important because checkbox variables are not present if the box is
not checked.
- skip = False
+ for filter_vars in visual['context'].itervalues():
+ if type(filter_vars) == dict: # this is a multi-context filter
+ # We add the filter only if *none* of its HTML variables are present on the
URL
+ # This important because checkbox variables are not present if the box is not
checked.
+ skip = any(html.has_var(uri_varname) for uri_varname in
filter_vars.iterkeys())
+ if not skip or only_count:
for uri_varname, value in filter_vars.items():
- if html.has_var(uri_varname):
- skip = True
- break
- if not skip or only_count:
- for uri_varname, value in filter_vars.items():
- html.set_var(uri_varname, "%s" % value)
+ html.set_var(uri_varname, "%s" % value)
# Vice versa: find all filters that belong to the current URI variables
# and create a context dictionary from that.