本文整理汇总了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()))
示例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,
})
示例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,
})