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


Python MobileBackend.load方法代碼示例

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


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

示例1: process_verification

# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load [as 別名]
def process_verification(phone_number, msg, backend_id=None):
    v = VerifiedNumber.by_phone(phone_number, True)
    if not v:
        return

    if not verification_response_ok(msg.text):
        return

    msg.domain = v.domain
    msg.couch_recipient_doc_type = v.owner_doc_type
    msg.couch_recipient = v.owner_id
    msg.save()

    if not domain_has_privilege(msg.domain, privileges.INBOUND_SMS):
        return

    if backend_id:
        backend = MobileBackend.load(backend_id)
    else:
        backend = MobileBackend.auto_load(phone_number, v.domain)

    # i don't know how to dynamically instantiate this object, which may be any number of doc types...
    #owner = CommCareMobileContactMixin.get(v.owner_id)
    assert v.owner_doc_type == 'CommCareUser'
    owner = CommCareUser.get(v.owner_id)

    v = owner.save_verified_number(v.domain, phone_number, True, backend.name)
    with localize(owner.language):
        send_sms_to_verified_number(v, _(CONFIRM))
開發者ID:jmaina,項目名稱:commcare-hq,代碼行數:31,代碼來源:verify.py

示例2: process_verification

# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load [as 別名]
def process_verification(phone_number, text, backend_id=None):
    v = VerifiedNumber.by_phone(phone_number, True)
    if not v:
        return

    if not verification_response_ok(text):
        return
    
    if backend_id:
        backend = MobileBackend.load(backend_id)
    else:
        backend = MobileBackend.auto_load(phone_number, v.domain)

    # i don't know how to dynamically instantiate this object, which may be any number of doc types...
    #owner = CommCareMobileContactMixin.get(v.owner_id)
    assert v.owner_doc_type == 'CommCareUser'
    owner = CommCareUser.get(v.owner_id)

    owner.save_verified_number(v.domain, phone_number, True, backend._id)

    api.send_sms(v.domain, owner._id, phone_number, CONFIRM)
開發者ID:comm-scriptek,項目名稱:commcare-hq,代碼行數:23,代碼來源:verify.py


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