Commit 07ebfb4c authored by Lucas Bourneuf's avatar Lucas Bourneuf

forgive user: default run_on available

parent 1990169c
......@@ -159,11 +159,17 @@ def compile_run_on(language:str, code:str, updater:callable=None) -> callable:
if language == 'python':
# we need to compile the source code to retrieve the run_on function
module = build_module_from_python_code(code)
if not hasattr(module, 'run_on'): # make a phony run_on
module.run_on = lambda context: ''
# print('MODULE w/o run_on:', type(module), {k: v for k, v in vars(module).items() if not k.startswith('__')})
run_on = module.run_on
elif language == 'python file':
with open(code) as fd:
source = fd.read()
module = build_module_from_python_code(source)
if not hasattr(module, 'run_on'): # make a phony run_on
module.run_on = lambda context: ''
# print('MODULE w/o run_on:', type(module), {k: v for k, v in vars(module).items() if not k.startswith('__')})
run_on = module.run_on
elif language == 'asp':
def run_on(context:str):
......
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 to comment