def save_parameter_from_order_in_memory(cls, order_parameters):
"""
Save key from the temp dict (where parameters loaded from the voice order where placed temporary)
into the memory dict
:param order_parameters: dict of key to save. {'key_name_in_memory': 'key_name_in_temp_dict'}
:return True if a value has been saved in the kalliope memory
"""
order_saved = False
if order_parameters is not None:
logger.debug("[Cortex] save_parameter_from_order_in_memory - User want to save: %s" % order_parameters)
logger.debug("[Cortex] save_parameter_from_order_in_memory - Available parameters in orders: %s"
% cls.temp)
for key, value in order_parameters.items():
# ask the cortex to save in memory the target "key" if it was in the order
if Utils.is_containing_bracket(value):
# if the key exist in the temp dict we can load it with jinja
value = jinja2.Template(value).render(Cortex.temp)
if value:
Cortex.save(key, value)
order_saved = True
return order_saved
评论列表
文章目录