Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def dispatcher(name, arg_string, body, isblock, environ):
if name in environ["macros"]:
macro = Macro(name, arg_string, body, isblock)
args, kwargs = parse_args(arg_string)
try:
return environ["macros"][name](macro, environ, *args, **kwargs)
except Exception as e:
return "ERROR: Error while executing macro %r (%s)" % (name, e)
else:
return "Macro not found!"