I have a module that I import into a main application called pageprocs.py, with a set of functions in it that generate other content and return it to a string. Pageprocs is supposed to be a way to allow authenticated users to create plugins for different types of content.
Then I have a list of lines: ['check_stats', 'build_table', 'build_ace'], which are the names of some functions in pageprocs. I need to execute the functions in the order in which they are in the list, and cannot find a way to do this without using exec ():
for i in list_of_funcs:
exec('pageprocs.%s()' % i)
This seems like a very bad idea to me, and it's not easy for me to catch exceptions in user code. Is there an alternative to running the code this way or does anyone have suggestions for creating custom content (I ask this because I may not quite understand the situation).
user521836
source
share