本文整理汇总了Python中temba.flows.models.Flow.handle_destination方法的典型用法代码示例。如果您正苦于以下问题:Python Flow.handle_destination方法的具体用法?Python Flow.handle_destination怎么用?Python Flow.handle_destination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类temba.flows.models.Flow
的用法示例。
在下文中一共展示了Flow.handle_destination方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: advance_stuck_runs
# 需要导入模块: from temba.flows.models import Flow [as 别名]
# 或者: from temba.flows.models.Flow import handle_destination [as 别名]
def advance_stuck_runs(apps, schema_editor):
# this data migration is not forward-compatible
from temba.flows.models import Flow, FlowStep, FlowRun, RuleSet
from temba.msgs.models import Msg
flows = Flow.objects.filter(flow_type="F", version_number=5)
if flows:
print "%d version 5 flows" % len(flows)
for flow in flows:
# looking for flows that start with a passive ruleset
ruleset = RuleSet.objects.filter(uuid=flow.entry_uuid, flow=flow).first()
if ruleset and not ruleset.is_pause():
# now see if there are any active steps at our current flow
steps = FlowStep.objects.filter(
run__is_active=True, step_uuid=ruleset.uuid, rule_value=None, left_on=None
).select_related("contact")
if steps:
print "\nAdvancing %d steps for %s:%s" % (len(steps), flow.org.name, flow.name)
for idx, step in enumerate(steps):
if (idx + 1) % 100 == 0:
print "\n\n *** Step %d of %d\n\n" % (idx + 1, len(steps))
# force them to be handled again
msg = Msg(contact=step.contact, text="", id=0)
Flow.handle_destination(ruleset, step, step.run, msg)