Merge remote-tracking branch 'official/master' into develop
This commit is contained in:
commit
ce0a46232d
|
@ -31,6 +31,18 @@ async def test_option_valid_name():
|
|||
with pytest.raises(ValueError):
|
||||
SymLinkOption(1, i)
|
||||
i = SymLinkOption("test1", i)
|
||||
#
|
||||
#
|
||||
#@pytest.mark.asyncio
|
||||
#async def test_option_unvalid_name():
|
||||
# with pytest.raises(ValueError):
|
||||
# IntOption('test.', '')
|
||||
# with pytest.raises(ValueError):
|
||||
# IntOption('test.val', '')
|
||||
# with pytest.raises(ValueError):
|
||||
# IntOption('.test', '')
|
||||
# with pytest.raises(ValueError):
|
||||
# OptionDescription('.test', '', [])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
@ -484,7 +484,8 @@ class TiramisuOptionInformation(CommonTiramisuOption):
|
|||
|
||||
@option_and_connection
|
||||
async def reset(self,
|
||||
key):
|
||||
key: str,
|
||||
) -> None:
|
||||
"""Remove information"""
|
||||
path = self._option_bag.path
|
||||
values = self._option_bag.config_bag.context.cfgimpl_get_values()
|
||||
|
@ -921,6 +922,16 @@ class TiramisuContextInformation(TiramisuConfig):
|
|||
"""List information's keys"""
|
||||
return await self._config_bag.context.impl_list_information(self._config_bag.connection)
|
||||
|
||||
@connection
|
||||
async def exportation(self):
|
||||
"""Export all informations"""
|
||||
return await self._config_bag.context.cfgimpl_get_values()._p_.exportation_informations(self._config_bag.connection)
|
||||
|
||||
@connection
|
||||
async def importation(self, informations):
|
||||
"""Import informations"""
|
||||
return await self._config_bag.context.cfgimpl_get_values()._p_.importation_informations(self._config_bag.connection, informations)
|
||||
|
||||
|
||||
class TiramisuContextValue(TiramisuConfig):
|
||||
"""Manage config value"""
|
||||
|
|
|
@ -358,10 +358,11 @@ async def manager_callback(callbk: Param,
|
|||
suffix = callbk.suffix
|
||||
else:
|
||||
if not option.impl_is_dynsymlinkoption():
|
||||
msg = 'option "{}" is not dynamic in callback of the option "{}"'
|
||||
raise ConfigError(_(msg).format(callbk_option.impl_get_display_name(),
|
||||
option.impl_get_display_name(),
|
||||
msg = 'option "{}" is not dynamic but is an argument of the dynamic option "{}" in a callback'
|
||||
raise ConfigError(_(msg).format(option.impl_get_display_name(),
|
||||
callbk_option.impl_get_display_name(),
|
||||
))
|
||||
#FIXME in same dynamic option?
|
||||
rootpath = option.rootpath
|
||||
suffix = option.impl_getsuffix()
|
||||
subdyn = callbk_option.getsubdyn()
|
||||
|
|
|
@ -40,6 +40,8 @@ submulti = 2
|
|||
def valid_name(name):
|
||||
if not isinstance(name, str):
|
||||
return False
|
||||
# if '.' in name:
|
||||
# return False
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -240,7 +240,9 @@ class Values:
|
|||
connection,
|
||||
informations,
|
||||
):
|
||||
await self.del_informations(connection)
|
||||
for path, path_infos in informations.items():
|
||||
path = self._storage.convert_path(path)
|
||||
for key, value in path_infos.items():
|
||||
await connection.execute("INSERT INTO information(key, value, session_id, path) VALUES "
|
||||
"($1, $2, $3, $4)", key, dumps(value), self._storage.database_id, path)
|
||||
|
|
Loading…
Reference in New Issue