當前位置: 首頁>>代碼示例>>Python>>正文


Python RepeatRecord.get方法代碼示例

本文整理匯總了Python中corehq.apps.repeaters.models.RepeatRecord.get方法的典型用法代碼示例。如果您正苦於以下問題:Python RepeatRecord.get方法的具體用法?Python RepeatRecord.get怎麽用?Python RepeatRecord.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在corehq.apps.repeaters.models.RepeatRecord的用法示例。


在下文中一共展示了RepeatRecord.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testLocks

# 需要導入模塊: from corehq.apps.repeaters.models import RepeatRecord [as 別名]
# 或者: from corehq.apps.repeaters.models.RepeatRecord import get [as 別名]
 def testLocks(self):
     r = RepeatRecord(domain='test')
     r.save()
     r2 = RepeatRecord.get(r._id)
     self.assertTrue(r.acquire_lock(datetime.utcnow()))
     r3 = RepeatRecord.get(r._id)
     self.assertFalse(r2.acquire_lock(datetime.utcnow()))
     self.assertFalse(r3.acquire_lock(datetime.utcnow()))
     r.release_lock()
     r4 = RepeatRecord.get(r._id)
     self.assertTrue(r4.acquire_lock(datetime.utcnow()))
開發者ID:bazuzi,項目名稱:commcare-hq,代碼行數:13,代碼來源:test_repeater.py

示例2: post

# 需要導入模塊: from corehq.apps.repeaters.models import RepeatRecord [as 別名]
# 或者: from corehq.apps.repeaters.models.RepeatRecord import get [as 別名]
 def post(self, request, domain):
     # Retriggers a repeat record
     record = RepeatRecord.get(request.POST.get('record_id'))
     record.fire(max_tries=1, force_send=True)
     record.save()
     return json_response({
         'success': record.succeeded,
         'failure_reason': record.failure_reason,
     })
開發者ID:ansarbek,項目名稱:commcare-hq,代碼行數:11,代碼來源:views.py

示例3: get

# 需要導入模塊: from corehq.apps.repeaters.models import RepeatRecord [as 別名]
# 或者: from corehq.apps.repeaters.models.RepeatRecord import get [as 別名]
    def get(self, request, domain):
        record = RepeatRecord.get(request.GET.get('record_id'))
        content_type = record.repeater.get_payload_generator(
            record.repeater.format_or_default_format()
        ).content_type
        try:
            payload = record.get_payload()
        except XFormNotFound:
            return json_response({
                'error': u'Odd, could not find payload for: {}'.format(record.payload_id)
            }, status_code=404)

        if content_type == 'text/xml':
            payload = indent_xml(payload)

        return json_response({
            'payload': payload,
            'content_type': content_type,
        })
開發者ID:ansarbek,項目名稱:commcare-hq,代碼行數:21,代碼來源:views.py


注:本文中的corehq.apps.repeaters.models.RepeatRecord.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。