tools (trigger, async_trigger): added no_cancel argument to point and asyncPoint when a trigger must not be cancellable
This commit is contained in:
parent
027909103e
commit
c5c46f3558
1 changed files with 18 additions and 3 deletions
|
|
@ -91,14 +91,21 @@ class TriggerManager(object):
|
|||
|
||||
All the triggers for that point will be run
|
||||
@param point_name: name of the trigger point
|
||||
@param *args: args to transmit to trigger
|
||||
@param *kwargs: kwargs to transmit to trigger
|
||||
if "triggers_no_cancel" is present, it will be popup out
|
||||
when set to True, this argument don't let triggers stop
|
||||
the workflow
|
||||
@return: True if the action must be continued, False else
|
||||
"""
|
||||
if point_name not in self.__triggers:
|
||||
return True
|
||||
|
||||
can_cancel = not kwargs.pop('triggers_no_cancel', False)
|
||||
|
||||
for priority, trigger in self.__triggers[point_name]:
|
||||
try:
|
||||
if not trigger(*args, **kwargs):
|
||||
if not trigger(*args, **kwargs) and can_cancel:
|
||||
return False
|
||||
except SkipOtherTriggers:
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue