Module: check_mk
Branch: master
Commit: 411131580576ed0110d6a096739de51af095aa0e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=411131580576ed…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 12 14:08:42 2018 +0200
Replaced use of __import__ with importlib.import_module
Change-Id: I7bbddccc30080a10989b028b7436ee58dfb1a07a
---
cmk/gui/visuals.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cmk/gui/visuals.py b/cmk/gui/visuals.py
index 7cf69b5..221ca13 100644
--- a/cmk/gui/visuals.py
+++ b/cmk/gui/visuals.py
@@ -29,6 +29,7 @@ import copy
import sys
import traceback
import json
+import importlib
import cmk.gui.pages
import cmk.gui.utils as utils
@@ -1398,7 +1399,7 @@ def collect_context_links_of(visual_type_name, this_visual,
active_filter_vars,
# FIXME: Make this cross module access cleaner
visual_type = visual_types[visual_type_name]
module_name = visual_type["module_name"]
- thing_module = __import__(module_name)
+ thing_module = importlib.import_module(module_name)
load_func_name = 'load_%s'% visual_type_name
if load_func_name not in thing_module.__dict__:
return context_links # in case of exception in "reporting", the load
function might be missing
@@ -1507,7 +1508,7 @@ def ajax_popup_add():
for visual_type_name, visual_type in visual_types.items():
if "popup_add_handler" in visual_type:
module_name = visual_type["module_name"]
- visual_module = __import__(module_name)
+ visual_module = importlib.import_module(module_name)
handler = visual_module.__dict__[visual_type["popup_add_handler"]]
visuals = handler(add_type)
@@ -1556,7 +1557,7 @@ def ajax_add_visual():
visual_type_name = html.var('visual_type') # dashboards / views / ...
visual_type = visual_types[visual_type_name]
module_name = visual_type["module_name"]
- visual_module = __import__(module_name)
+ visual_module = importlib.import_module(module_name)
handler = visual_module.__dict__[visual_type["add_visual_handler"]]
visual_name = html.var("visual_name") # add to this visual