Module: check_mk
Branch: master
Commit: 1f383dcb1e890681636a5db6903a3e052f97d594
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f383dcb1e8906…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Tue Jul 24 13:19:39 2018 +0200
Remove None module entries to avoid crash in cmk/gui/modules.py
Change-Id: I07730cab181adb4200eb01024bb8289cade9c384
---
cmk/gui/modules.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/cmk/gui/modules.py b/cmk/gui/modules.py
index a0a4a6a..7ba9684 100644
--- a/cmk/gui/modules.py
+++ b/cmk/gui/modules.py
@@ -137,9 +137,12 @@ def load_all_plugins():
def _cmk_gui_top_level_modules():
return [ module for name, module in sys.modules.items()
- if (name.startswith("cmk.gui.") and len(name.split("."))
== 3)
- or (name.startswith("cmk.gui.cee.") and
len(name.split(".")) == 4)
- or (name.startswith("cmk.gui.cme.") and
len(name.split(".")) == 4) ]
+ # None entries are only an import optimization of cPython and can be
removed:
+ #
https://www.python.org/dev/peps/pep-0328/#relative-imports-and-indirection-…
+ if module is not None
+ and ((name.startswith("cmk.gui.") and
len(name.split(".")) == 3)
+ or (name.startswith("cmk.gui.cee.") and
len(name.split(".")) == 4)
+ or (name.startswith("cmk.gui.cme.") and
len(name.split(".")) == 4)) ]