add leader_to_list to dict message

This commit is contained in:
Emmanuel Garette 2019-12-28 12:30:32 +01:00
parent 52ddd76b1a
commit 1861dc59d4

View file

@ -26,7 +26,7 @@ from .i18n import _
from .setting import ConfigBag, OptionBag, owners, groups, Undefined, undefined, \
FORBIDDEN_SET_PROPERTIES, SPECIAL_PROPERTIES, EXPIRATION_TIME
from .config import KernelConfig, SubConfig, KernelGroupConfig, KernelMetaConfig, KernelMixConfig
from .option import ChoiceOption, RegexpOption, OptionDescription
from .option import RegexpOption, OptionDescription
from .todict import TiramisuDict
from .asyncinit import asyncinit
@ -497,7 +497,7 @@ def option_type(typ):
if not option.impl_is_follower() and not option.impl_is_leader():
raise APIError(_('please specify a valid sub function ({})').format(func.__name__))
elif typ == 'choice':
if not isinstance(option, ChoiceOption):
if not option.get_type() == 'choice':
raise APIError(_('please specify a valid sub function ({})').format(func.__name__))
return await func(*args, **kwargs)
return wrapped
@ -514,7 +514,8 @@ class TiramisuOptionValue(CommonTiramisuOption):
async def dict(self,
flatten=False,
withwarning: bool=False,
fullpath=False):
fullpath=False,
leader_to_list=False):
"""Dict with path as key and value"""
name = self._option_bag.option.impl_getname()
subconfig = await self._subconfig.get_subconfig(self._option_bag)
@ -524,7 +525,8 @@ class TiramisuOptionValue(CommonTiramisuOption):
config_bag.remove_warnings()
return await subconfig.make_dict(config_bag=config_bag,
flatten=flatten,
fullpath=fullpath)
fullpath=fullpath,
leader_to_list=leader_to_list)
@option_type('option')
async def get(self):