當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。