Changing utils.all_from_module to really only load variables actually

defined in the module in question (so will no longer include imports
from other modules). Added utils.callables_from_module to handle the
common case of only wanting callable functions from a module (used by
lock funcs, inlinefuncs etc).
This commit is contained in:
Griatch 2016-02-10 15:23:17 +01:00
parent b8060b9ea0
commit d966051558
4 changed files with 33 additions and 12 deletions

View file

@ -140,12 +140,7 @@ def _cache_lockfuncs():
global _LOCKFUNCS
_LOCKFUNCS = {}
for modulepath in settings.LOCK_FUNC_MODULES:
mod = utils.mod_import(modulepath)
if mod:
for tup in (tup for tup in inspect.getmembers(mod) if callable(tup[1])):
_LOCKFUNCS[tup[0]] = tup[1]
else:
logger.log_err("Couldn't load %s from PERMISSION_FUNC_MODULES." % modulepath)
_LOCKFUNCS.update(utils.callables_from_module(modulepath))
#
# pre-compiled regular expressions