core (main): if keep_id is set in action_new, use it as action_id
This commit is contained in:
parent
5ba4239fcc
commit
45e15eb189
1 changed files with 6 additions and 3 deletions
|
|
@ -1263,20 +1263,23 @@ class SAT(service.Service):
|
|||
keep_id=None,
|
||||
profile=C.PROF_KEY_NONE,
|
||||
):
|
||||
"""Shortcut to bridge.action_new which generate and id and keep for retrieval
|
||||
"""Shortcut to bridge.action_new which generate an id and keep for retrieval
|
||||
|
||||
@param action_data(dict): action data (see bridge documentation)
|
||||
@param security_limit: %(doc_security_limit)s
|
||||
@param keep_id(None, unicode): if not None, used to keep action for differed
|
||||
retrieval. Must be set to the callback_id.
|
||||
retrieval. The value will be used as callback_id, be sure to use an unique
|
||||
value.
|
||||
Action will be deleted after 30 min.
|
||||
@param profile: %(doc_profile)s
|
||||
"""
|
||||
id_ = str(uuid.uuid4())
|
||||
if keep_id is not None:
|
||||
id_ = keep_id
|
||||
client = self.get_client(profile)
|
||||
action_timer = reactor.callLater(60 * 30, self._kill_action, keep_id, client)
|
||||
client.actions[keep_id] = (action_data, id_, security_limit, action_timer)
|
||||
else:
|
||||
id_ = str(uuid.uuid4())
|
||||
|
||||
self.bridge.action_new(
|
||||
data_format.serialise(action_data), id_, security_limit, profile
|
||||
|
|
|
|||
Loading…
Reference in a new issue