Replaced literal for testing with a variable fix.
This commit is contained in:
parent
0bf2d102c6
commit
cd421cc2fb
@ -17,7 +17,7 @@ def load_parsers(rel_dir="FourmiCrawler/parsers"):
|
|||||||
parsers = []
|
parsers = []
|
||||||
|
|
||||||
for py in [f[:-3] for f in os.listdir(path) if f.endswith('.py') and f != '__init__.py']:
|
for py in [f[:-3] for f in os.listdir(path) if f.endswith('.py') and f != '__init__.py']:
|
||||||
mod = __import__('.'.join(["FourmiCrawler.parsers", py]), fromlist=[py]) # [todo] - This module name should be derived from the rel_dir variable
|
mod = __import__('.'.join([rel_dir.replace("/", "."), py]), fromlist=[py])
|
||||||
classes = [getattr(mod, x) for x in dir(mod) if inspect.isclass(getattr(mod, x))]
|
classes = [getattr(mod, x) for x in dir(mod) if inspect.isclass(getattr(mod, x))]
|
||||||
for cls in classes:
|
for cls in classes:
|
||||||
if re.match(path + "/*", inspect.getfile(cls)):
|
if re.match(path + "/*", inspect.getfile(cls)):
|
||||||
|
Reference in New Issue
Block a user