Skip to content

Commit 7259b41

Browse files
authored
Merge pull request #32 from johandahlberg/bug_fixes
Bug fixes
2 parents c5eb497 + a6771cf commit 7259b41

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

checkQC/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
__version__ = "1.1.0"
2+
__version__ = "1.1.1"

checkQC/handlers/qc_handler_factory.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import importlib
33
import pkgutil
44

5+
import checkQC.handlers
56
from checkQC.handlers.qc_handler import QCHandler
67

78

@@ -20,10 +21,12 @@ def create_subclass_instance(class_name, class_config):
2021
:param class_config: dictionary with configuration for the class
2122
:return: A instance of the class represented by class_name
2223
"""
23-
pkgs = list(pkgutil.walk_packages('checkQC.handlers'))
24-
for importer, modname, ispkg in pkgs:
25-
if "checkQC.handlers" in modname:
26-
importlib.import_module(modname)
24+
package = checkQC.handlers
25+
prefix = package.__name__ + "."
26+
27+
modules = list(pkgutil.iter_modules(package.__path__, prefix))
28+
for importer, modname, ispkg in modules:
29+
importlib.import_module(modname)
2730
qc_handler_subclasses = list(QCHandler.__subclasses__())
2831
try:
2932
i = list(map(lambda clazz: clazz.__name__, qc_handler_subclasses)).index(class_name)

checkQC/web_app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def start_web_app(self, monitoring_path, port, config_file, log_config, debug):
7272

7373
log.info("Starting checkqc-ws at port: {}".format(port))
7474

75+
if not os.path.isdir(monitoring_path):
76+
log.error("{} is not a directory".format(monitoring_path))
77+
raise AssertionError("{} is not a directory".format(monitoring_path))
78+
7579
# See the comment above in the CheckQCHandler as to why this somewhat backward way
7680
# is used to setup the server and ProcessPoolExecutor. /JD 2017-11-08
7781
web_app = self._make_app(monitoring_path=monitoring_path, qc_config_file=config_file, debug=debug)

0 commit comments

Comments
 (0)