import/export informations
This commit is contained in:
parent
b0462a1e80
commit
64017d5cd4
|
@ -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()
|
||||
|
|
|
@ -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