Module: check_mk
Branch: master
Commit: 103f24482a07cc20dd12ebc429fb9feb8c756189
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=103f24482a07cc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 23 15:58:34 2014 +0200
Fix exception in comment-icon
---
web/htdocs/views.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 64be415..d264da8 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1327,10 +1327,12 @@ def view_options(viewname):
# variables for each option.
if config.may("general.painter_options"):
for option_name, opt in multisite_painter_options.items():
- old_value = v.get(option_name)
- var_prefix = 'po_' + option_name
+ have_old_value = option_name in v
+ if have_old_value:
+ old_value = v.get(option_name)
# Are there settings for this painter option present?
+ var_prefix = 'po_' + option_name
if html.has_var_prefix(var_prefix):
# Get new value for the option from the value spec
@@ -1340,11 +1342,13 @@ def view_options(viewname):
v[option_name] = value
opt['value'] = value # make globally present for painters
- if v[option_name] != old_value:
+ if not have_old_value or v[option_name] != old_value:
must_save = True
- else:
+ elif have_old_value:
opt['value'] = old_value # make globally present for painters
+ elif 'value' in opt:
+ del opt['value']
# If the user has no permission for changing painter options
# (or has *lost* his permission) then we need to remove all
@@ -2376,7 +2380,8 @@ def get_painter_option(name):
opt = multisite_painter_options[name]
if not config.may("general.painter_options"):
return opt['valuespec'].default_value()
- return opt.get("value", opt['valuespec'].default_value())
+ else:
+ return opt.get("value", opt['valuespec'].default_value())
def get_host_tags(row):
if type(row.get("host_custom_variables")) == dict:
Module: check_mk
Branch: master
Commit: 6be42230daaa560e21545515a5d4d5df4daf7002
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6be42230daaa56…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 23 11:05:06 2014 +0200
userdb: avoid warning in Apache log about globals
---
web/htdocs/userdb.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 80c8d3f..9ab3306 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -38,6 +38,9 @@ builtin_user_attribute_names = []
# Load all userdb plugins
def load_plugins():
+ global user_attributes
+ global multisite_user_connectors
+
# Do not cache the custom user attributes. They can be created by the user
# during runtime, means they need to be loaded during each page request.
# But delete the old definitions before to also apply removals of attributes
@@ -52,8 +55,8 @@ def load_plugins():
return
# declare & initialize global vars
- global user_attributes ; user_attributes = {}
- global multisite_user_connectors ; multisite_user_connectors = []
+ user_attributes = {}
+ multisite_user_connectors = []
load_web_plugins("userdb", globals())