Module: check_mk
Branch: master
Commit: 0841ea5f07663a49d95a0fab3c06d58afb08fb37
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0841ea5f07663a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 7 11:22:13 2016 +0200
Fixed another wrong data serialization to JS
---
web/htdocs/help.py | 7 ++++++-
web/htdocs/sidebar.py | 9 +++++++--
web/htdocs/wato.py | 11 ++++++++---
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/help.py b/web/htdocs/help.py
index 28b579e..79f9b4f 100644
--- a/web/htdocs/help.py
+++ b/web/htdocs/help.py
@@ -26,7 +26,12 @@
import config
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
def ajax_switch_help():
state = html.var("enabled", "") != ""
config.save_user_file("help", state)
- html.write("%r" % state)
+ html.write(json.dumps(state))
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 536a0cc..b4c33d4 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -34,6 +34,11 @@ import notify, werks
import sites
from lib import *
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
# Constants to be used in snapins
snapin_width = 230
@@ -277,8 +282,8 @@ def page_side():
html.write("sidebar_update_interval = %0.2f;\n" %
config.sidebar_update_interval)
html.write("registerEdgeListeners();\n")
html.write("set_sidebar_size();\n")
- html.write("refresh_snapins = %r;\n" % refresh_snapins)
- html.write("restart_snapins = %r;\n" % restart_snapins)
+ html.write("refresh_snapins = %s;\n" % json.dumps(refresh_snapins))
+ html.write("restart_snapins = %s;\n" % json.dumps(restart_snapins))
html.write("sidebar_scheduler();\n")
html.write("window.onresize = function() { set_sidebar_size(); };\n")
html.write("if (contentFrameAccessible()) { update_content_location();
};\n")
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index b581b29..2b7e0d8 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -101,6 +101,11 @@ from watolib import *
import cmk.store as store
from cmk.regex import escape_regex_chars, regex
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
g_html_head_open = False
wato_styles = [ "pages", "wato", "status" ]
@@ -830,8 +835,8 @@ def show_hosts(folder):
html.javascript(
'g_page_id = "wato-folder-%s";\n'
'g_selection = "%s";\n'
- 'g_selected_rows = %r;\n'
- 'init_rowselect();' % ('/' + folder.path(),
weblib.selection_id(), selected)
+ 'g_selected_rows = %s;\n'
+ 'init_rowselect();' % ('/' + folder.path(),
weblib.selection_id(), json.dumps(selected))
)
@@ -3899,7 +3904,7 @@ def mode_parentscan(phase):
gwcreat and 1 or 0, # Gateway hosts created
state in [ "failed", "dnserror",
"garbled" ] and 1 or 0, # Errors
]
- result = "%r\n%s: %s<br>\n" % (counts, host_name,
message)
+ result = "%s\n%s: %s<br>\n" % (json.dumps(counts),
host_name, message)
except Exception, e:
result = repr([ 'failed', 1, 0, 0, 0, 0, 0, 1 ]) +
"\n"