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


Python CaseRepeater.get方法代码示例

本文整理汇总了Python中corehq.apps.receiverwrapper.models.CaseRepeater.get方法的典型用法代码示例。如果您正苦于以下问题:Python CaseRepeater.get方法的具体用法?Python CaseRepeater.get怎么用?Python CaseRepeater.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在corehq.apps.receiverwrapper.models.CaseRepeater的用法示例。


在下文中一共展示了CaseRepeater.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from corehq.apps.receiverwrapper.models import CaseRepeater [as 别名]
# 或者: from corehq.apps.receiverwrapper.models.CaseRepeater import get [as 别名]
    def handle(self, *args, **options):
        domain = 'care-bihar'

        # forward all cases that were last modified between these dates
        def should_forward_case(case):
            min_date = datetime(2013, 9, 10)
            max_date = datetime(2013, 11, 7)
            return (case.server_modified_on
                    and min_date < case.server_modified_on < max_date)

        prod_repeater = CaseRepeater.get('a478a5a3d8964338cb3124de77e3ec58')
        success_count = 0
        fail_count = 0
        for case in get_cases_in_domain(domain):
            try:
                if should_forward_case(case):
                    prod_repeater.register(case)
                    success_count += 1
            except Exception:
                fail_count += 1
                logging.exception('problem creating repeater stub for case %s' % case._id)

        print 'successfully forwarded %s cases. %s were not processed' % (success_count, fail_count)
开发者ID:LifeCoaching,项目名称:commcare-hq,代码行数:25,代码来源:bihar_create_backlogged_repeaters.py


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