本文整理汇总了Python中corehq.apps.sms.mixin.VerifiedNumber.contact_last_modified方法的典型用法代码示例。如果您正苦于以下问题:Python VerifiedNumber.contact_last_modified方法的具体用法?Python VerifiedNumber.contact_last_modified怎么用?Python VerifiedNumber.contact_last_modified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.sms.mixin.VerifiedNumber
的用法示例。
在下文中一共展示了VerifiedNumber.contact_last_modified方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sync_case_phone_number
# 需要导入模块: from corehq.apps.sms.mixin import VerifiedNumber [as 别名]
# 或者: from corehq.apps.sms.mixin.VerifiedNumber import contact_last_modified [as 别名]
def _sync_case_phone_number(contact_case):
phone_info = contact_case.get_phone_info()
lock_keys = ['sync-case-phone-number-for-%s' % contact_case._id]
if phone_info.phone_number:
lock_keys.append('verifying-phone-number-%s' % phone_info.phone_number)
with CriticalSection(lock_keys):
phone_number = contact_case.get_verified_number()
if (
phone_number and
phone_number.contact_last_modified and
phone_number.contact_last_modified >= contact_case.server_modified_on
):
return
if phone_info.requires_entry:
try:
contact_case.verify_unique_number(phone_info.phone_number)
except (InvalidFormatException, PhoneNumberInUseException):
if phone_number:
phone_number.delete()
return
if not phone_number:
phone_number = VerifiedNumber(
domain=contact_case.domain,
owner_doc_type=contact_case.doc_type,
owner_id=contact_case._id,
)
elif _phone_number_is_same(phone_number, phone_info):
return
phone_number.phone_number = phone_info.phone_number
phone_number.backend_id = phone_info.sms_backend_id
phone_number.ivr_backend_id = phone_info.ivr_backend_id
phone_number.verified = True
phone_number.contact_last_modified = contact_case.server_modified_on
phone_number.save()
else:
if phone_number:
phone_number.delete()