Commit c4aad1c6 by Josué A

Added support for loading classes by providing a class reference.

parent 3de3a25b
...@@ -53,9 +53,12 @@ class SchedulerInfo(object): ...@@ -53,9 +53,12 @@ class SchedulerInfo(object):
try: try:
clas = None clas = None
if self.clas: if self.clas:
name = self.clas.rsplit('.', 1)[1] if type(self.clas) is type:
importlib.import_module(self.clas) clas = self.clas
clas = getattr(importlib.import_module(self.clas), name) else:
name = self.clas.rsplit('.', 1)[1]
importlib.import_module(self.clas)
clas = getattr(importlib.import_module(self.clas), name)
elif self.filename: elif self.filename:
path, name = os.path.split(self.filename) path, name = os.path.split(self.filename)
name = os.path.splitext(name)[0] name = os.path.splitext(name)[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment