Commit 4798a469 by Calen Pennington

Add docstring for load_function

parent 3b36fbf9
...@@ -16,6 +16,12 @@ FUNCTION_KEYS = ['render_template'] ...@@ -16,6 +16,12 @@ FUNCTION_KEYS = ['render_template']
def load_function(path): def load_function(path):
"""
Load a function by name.
path is a string of the form "path.to.module.function"
returns the imported python object `function` from `path.to.module`
"""
module_path, _, name = path.rpartition('.') module_path, _, name = path.rpartition('.')
return getattr(import_module(module_path), name) return getattr(import_module(module_path), name)
......
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