mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Correctly call actions inside subcategories
This commit is contained in:
parent
30d6b30569
commit
4b27bf6e83
1 changed files with 15 additions and 7 deletions
|
@ -453,8 +453,16 @@ class ActionsMap(object):
|
||||||
return arguments.get(TO_RETURN_PROP)
|
return arguments.get(TO_RETURN_PROP)
|
||||||
|
|
||||||
# Retrieve action information
|
# Retrieve action information
|
||||||
namespace, category, action = tid
|
if len(tid) == 4:
|
||||||
func_name = '%s_%s' % (category, action.replace('-', '_'))
|
namespace, category, subcategory, action = tid
|
||||||
|
func_name = '%s_%s_%s' % (category, subcategory, action.replace('-', '_'))
|
||||||
|
full_action_name = "%s.%s.%s.%s" % (namespace, category, subcategory, action)
|
||||||
|
else:
|
||||||
|
assert len(tid) == 3
|
||||||
|
namespace, category, action = tid
|
||||||
|
subcategory = None
|
||||||
|
func_name = '%s_%s' % (category, action.replace('-', '_'))
|
||||||
|
full_action_name = "%s.%s.%s" % (namespace, category, action)
|
||||||
|
|
||||||
# Lock the moulinette for the namespace
|
# Lock the moulinette for the namespace
|
||||||
with MoulinetteLock(namespace, timeout):
|
with MoulinetteLock(namespace, timeout):
|
||||||
|
@ -465,17 +473,17 @@ class ActionsMap(object):
|
||||||
func = getattr(mod, func_name)
|
func = getattr(mod, func_name)
|
||||||
except (AttributeError, ImportError):
|
except (AttributeError, ImportError):
|
||||||
logger.exception("unable to load function %s.%s.%s",
|
logger.exception("unable to load function %s.%s.%s",
|
||||||
namespace, category, func_name)
|
namespace, func_name)
|
||||||
raise MoulinetteError(errno.EIO, m18n.g('error_see_log'))
|
raise MoulinetteError(errno.EIO, m18n.g('error_see_log'))
|
||||||
else:
|
else:
|
||||||
log_id = start_action_logging()
|
log_id = start_action_logging()
|
||||||
if logger.isEnabledFor(logging.DEBUG):
|
if logger.isEnabledFor(logging.DEBUG):
|
||||||
# Log arguments in debug mode only for safety reasons
|
# Log arguments in debug mode only for safety reasons
|
||||||
logger.info('processing action [%s]: %s.%s.%s with args=%s',
|
logger.info('processing action [%s]: %s with args=%s',
|
||||||
log_id, namespace, category, action, arguments)
|
log_id, full_action_name, arguments)
|
||||||
else:
|
else:
|
||||||
logger.info('processing action [%s]: %s.%s.%s',
|
logger.info('processing action [%s]: %s',
|
||||||
log_id, namespace, category, action)
|
log_id, full_action_name)
|
||||||
|
|
||||||
# Load translation and process the action
|
# Load translation and process the action
|
||||||
m18n.load_namespace(namespace)
|
m18n.load_namespace(namespace)
|
||||||
|
|
Loading…
Add table
Reference in a new issue