Module: check_mk
Branch: master
Commit: 0faa15c2158453d9183f6ac89e1d2ea3c2e76e1a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0faa15c2158453…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 10 17:25:55 2017 +0100
Revert "Refactoring htmllib: changed mechanics of javascript_file."
It broke the javascript_file tests.
This reverts commit f89337c03d95c287ce6251247c6fabd0a9235b1c.
Change-Id: I0bd2b18c5d8d55d34b217ccf073510494760e133
---
web/htdocs/html_mod_python.py | 2 +-
web/htdocs/htmllib.py | 6 +++---
web/htdocs/valuespec.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index 49eff00..abd5ab8 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -329,7 +329,7 @@ class html_mod_python(htmllib.html):
for min_part in min_parts:
path_pattern = cmk.paths.omd_root + "%s" + rel_path + "/"
+ jsname + min_part + ".js"
if os.path.exists(path_pattern % "") or os.path.exists(path_pattern
% "/local"):
- filename_for_browser = 'js/%s%s-%s.js' % (jsname, min_part,
cmk.__version__)
+ filename_for_browser = '%s%s-%s' % (jsname, min_part,
cmk.__version__)
break
return filename_for_browser
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 61713e7..cf7f980 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -640,9 +640,9 @@ class HTMLGenerator(Escaper, OutputFunnel):
return self.write(self.render_javascript(code))
- def javascript_file(self, src):
- """ <script type="text/javascript"
src="%(name)"/>\n """
- return self.write(self._render_content_tag('script', '',
type_="text/javascript", src=src))
+ def javascript_file(self, filename):
+ """ <script type="text/javascript"
src="js/%(name)s.js"/>\n """
+ return self.write(self._render_content_tag('script', '',
type_="text/javascript", src='js/%s.js' % filename))
def render_img(self, src, **attrs):
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index f6d5ee8..e9410bf 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -4086,7 +4086,7 @@ class Color(ValueSpec):
if not value:
value = "#FFFFFF"
- html.javascript_file("js/colorpicker.js")
+ html.javascript_file("colorpicker")
# Holds the actual value for form submission
html.hidden_field(varprefix + "_value", value or '', varprefix
+ "_value", add_var = True)