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


Python RepeatRecord.wrap方法代码示例

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


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

示例1: handle

# 需要导入模块: from corehq.apps.receiverwrapper.models import RepeatRecord [as 别名]
# 或者: from corehq.apps.receiverwrapper.models.RepeatRecord import wrap [as 别名]
    def handle(self, *args, **options):
        domain = args[0]
        db = Domain.get_db()
        doc_ids = get_doc_ids(domain, "RepeatRecord", db)
        count = len(doc_ids)
        print "found %s doc ids" % count
        latest = datetime.min
        latest_doc = None
        for i, doc in enumerate(iter_docs(db, doc_ids)):
            wrapped = RepeatRecord.wrap(doc)
            if i % 100 == 0:
                print "checked %s / %s" % (i, count)
            if wrapped.last_checked and wrapped.last_checked > latest:
                latest = wrapped.last_checked
                latest_doc = wrapped
                print "new latest: %s" % latest

        if latest_doc:
            print "latest repeater date is %s" % latest
            print "latest repeater is %s" % latest_doc._id
        else:
            print "no relevant repeaters found"
开发者ID:puttarajubr,项目名称:commcare-hq,代码行数:24,代码来源:repeater_times.py

示例2: check_inline_form_repeaters

# 需要导入模块: from corehq.apps.receiverwrapper.models import RepeatRecord [as 别名]
# 或者: from corehq.apps.receiverwrapper.models.RepeatRecord import wrap [as 别名]
def check_inline_form_repeaters(post_fn=None):
    """old-style FormRepeater grandfathered in"""
    now = datetime.utcnow()
    forms = XFormInstance.view('receiverwrapper/forms_with_pending_repeats',
        startkey="",
        endkey=json_format_datetime(now),
        include_docs=True,
    )

    for form in forms:
        if hasattr(form, 'repeats'):
            for repeat_record in form.repeats:
                record = dict(repeat_record)
                url = record.pop('url')
                record = RepeatRecord.wrap(record)
                record.payload_id = form.get_id

                record._repeater = FormRepeater(url=url)
                record.fire(post_fn=post_fn)
                record = record.to_json()
                record['url'] = url
                repeat_record.update(record)
            form.save()
开发者ID:mchampanis,项目名称:core-hq,代码行数:25,代码来源:tasks.py


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