##// END OF EJS Templates
Use globals dict to find right export function instead of...
Jonathan Frederic -
Show More
@@ -474,14 +474,10 b' def export_by_name(nb, template_name, config=None, transformers=None, filters=No'
474 474 specifies what extension the output should be saved as.
475 475 """
476 476
477 #Use reflection to get functions defined in this module.
478 cls_functions = inspect.getmembers(sys.modules[__name__], inspect.isfunction)
477 function_name = "export_" + template_name.lower()
479 478
480 #Check if the characters following "export_" (7 char) equals the template name.
481 for (function_name, function_handle) in cls_functions:
482 function_name = function_name.lower()
483 if (len(function_name) > 7 and function_name[7:] == template_name.lower()):
484 return function_handle(nb, config, transformers, filters)
485
486 return None
479 if function_name in globals():
480 return globals()[function_name](nb, config, transformers, filters)
481 else:
482 return None
487 483 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now