当前位置: 首页>>代码示例>>Python>>正文


Python Flow.handle_destination方法代码示例

本文整理汇总了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)
开发者ID:saakaifoundry,项目名称:rapidpro,代码行数:35,代码来源:0024_advance_stuck_runs.py


注:本文中的temba.flows.models.Flow.handle_destination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。