import/export informations
This commit is contained in:
parent
b0462a1e80
commit
64017d5cd4
3 changed files with 18 additions and 4 deletions
|
@ -484,7 +484,8 @@ class TiramisuOptionInformation(CommonTiramisuOption):
|
||||||
|
|
||||||
@option_and_connection
|
@option_and_connection
|
||||||
async def reset(self,
|
async def reset(self,
|
||||||
key):
|
key: str,
|
||||||
|
) -> None:
|
||||||
"""Remove information"""
|
"""Remove information"""
|
||||||
path = self._option_bag.path
|
path = self._option_bag.path
|
||||||
values = self._option_bag.config_bag.context.cfgimpl_get_values()
|
values = self._option_bag.config_bag.context.cfgimpl_get_values()
|
||||||
|
@ -921,6 +922,16 @@ class TiramisuContextInformation(TiramisuConfig):
|
||||||
"""List information's keys"""
|
"""List information's keys"""
|
||||||
return await self._config_bag.context.impl_list_information(self._config_bag.connection)
|
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):
|
class TiramisuContextValue(TiramisuConfig):
|
||||||
"""Manage config value"""
|
"""Manage config value"""
|
||||||
|
|
|
@ -358,10 +358,11 @@ async def manager_callback(callbk: Param,
|
||||||
suffix = callbk.suffix
|
suffix = callbk.suffix
|
||||||
else:
|
else:
|
||||||
if not option.impl_is_dynsymlinkoption():
|
if not option.impl_is_dynsymlinkoption():
|
||||||
msg = 'option "{}" is not dynamic in callback of the option "{}"'
|
msg = 'option "{}" is not dynamic but is an argument of the dynamic option "{}" in a callback'
|
||||||
raise ConfigError(_(msg).format(callbk_option.impl_get_display_name(),
|
raise ConfigError(_(msg).format(option.impl_get_display_name(),
|
||||||
option.impl_get_display_name(),
|
callbk_option.impl_get_display_name(),
|
||||||
))
|
))
|
||||||
|
#FIXME in same dynamic option?
|
||||||
rootpath = option.rootpath
|
rootpath = option.rootpath
|
||||||
suffix = option.impl_getsuffix()
|
suffix = option.impl_getsuffix()
|
||||||
subdyn = callbk_option.getsubdyn()
|
subdyn = callbk_option.getsubdyn()
|
||||||
|
|
|
@ -240,7 +240,9 @@ class Values:
|
||||||
connection,
|
connection,
|
||||||
informations,
|
informations,
|
||||||
):
|
):
|
||||||
|
await self.del_informations(connection)
|
||||||
for path, path_infos in informations.items():
|
for path, path_infos in informations.items():
|
||||||
|
path = self._storage.convert_path(path)
|
||||||
for key, value in path_infos.items():
|
for key, value in path_infos.items():
|
||||||
await connection.execute("INSERT INTO information(key, value, session_id, path) VALUES "
|
await connection.execute("INSERT INTO information(key, value, session_id, path) VALUES "
|
||||||
"($1, $2, $3, $4)", key, dumps(value), self._storage.database_id, path)
|
"($1, $2, $3, $4)", key, dumps(value), self._storage.database_id, path)
|
||||||
|
|
Loading…
Reference in a new issue