本文整理匯總了Python中corehq.apps.sms.mixin.MobileBackend.load_by_name方法的典型用法代碼示例。如果您正苦於以下問題:Python MobileBackend.load_by_name方法的具體用法?Python MobileBackend.load_by_name怎麽用?Python MobileBackend.load_by_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類corehq.apps.sms.mixin.MobileBackend
的用法示例。
在下文中一共展示了MobileBackend.load_by_name方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: tearDownClass
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def tearDownClass(cls):
MobileBackend.load_by_name(TEST_DOMAIN, TEST_BACKEND).delete()
CommCareUser.get_by_username('stella').delete()
CommCareUser.get_by_username('super').delete()
delete_all_locations()
LocationType.objects.all().delete()
for product in Product.by_domain(TEST_DOMAIN):
product.delete()
SQLProduct.objects.all().delete()
EWSGhanaConfig.for_domain(TEST_DOMAIN).delete()
DocDomainMapping.objects.all().delete()
generator.delete_all_subscriptions()
Domain.get_by_name(TEST_DOMAIN).delete()
示例2: tearDownClass
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def tearDownClass(cls):
MobileBackend.load_by_name(TEST_DOMAIN, TEST_BACKEND).delete()
CommCareUser.get_by_username('stella').delete()
CommCareUser.get_by_username('bella').delete()
CommCareUser.get_by_username('trella').delete()
CommCareUser.get_by_username('msd_person').delete()
for product in Product.by_domain(TEST_DOMAIN):
product.delete()
SQLProduct.objects.all().delete()
ILSGatewayConfig.for_domain(TEST_DOMAIN).delete()
DocDomainMapping.objects.all().delete()
Location.by_site_code(TEST_DOMAIN, 'loc1').delete()
Location.by_site_code(TEST_DOMAIN, 'loc2').delete()
Location.by_site_code(TEST_DOMAIN, 'dis1').delete()
Location.by_site_code(TEST_DOMAIN, 'reg1').delete()
Location.by_site_code(TEST_DOMAIN, 'moh1').delete()
SQLLocation.objects.all().delete()
generator.delete_all_subscriptions()
Domain.get_by_name(TEST_DOMAIN).delete()
示例3: send_sms_with_backend_name
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def send_sms_with_backend_name(domain, phone_number, text, backend_name):
phone_number = clean_phone_number(phone_number)
msg = SMSLog(
domain=domain,
phone_number=phone_number,
direction=OUTGOING,
date=datetime.utcnow(),
text=text
)
def onerror():
logging.exception("Exception while sending SMS to %s with backend name %s from domain %s" % (phone_number, backend_name, domain))
return send_message_via_backend(msg, MobileBackend.load_by_name(domain, backend_name), onerror=onerror)
示例4: send_sms_with_backend_name
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None):
phone_number = clean_phone_number(phone_number)
backend = MobileBackend.load_by_name(domain, backend_name)
msg = SMSLog(
domain=domain,
phone_number=phone_number,
direction=OUTGOING,
date=datetime.utcnow(),
backend_id=backend._id,
text=text
)
add_msg_tags(msg, metadata)
return queue_outgoing_sms(msg)
示例5: send_sms_with_backend_name
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def send_sms_with_backend_name(domain, phone_number, text, backend_name, metadata=None):
phone_number = clean_phone_number(phone_number)
backend = MobileBackend.load_by_name(domain, backend_name)
msg = SMSLog(
domain=domain,
phone_number=phone_number,
direction=OUTGOING,
date=datetime.utcnow(),
backend_id=backend._id,
text=text
)
add_msg_tags(msg, metadata)
def onerror():
logging.exception("Exception while sending SMS to %s with backend name %s from domain %s" % (phone_number, backend_name, domain))
return queue_outgoing_sms(msg, onerror=onerror)
示例6: set_default_backend
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def set_default_backend(self):
domain_object = Domain.get_by_name(self.domain)
domain_object.default_sms_backend_id = MobileBackend.load_by_name(None, 'MOBILE_BACKEND_TEST').get_id
domain_object.save()
示例7: set_default_backend
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import load_by_name [as 別名]
def set_default_backend(self):
domain_object = Domain.get_by_name(self.domain)
domain_object.default_sms_backend_id = MobileBackend.load_by_name(None, 'MOBILE_BACKEND_TEST').get_id
domain_object.send_to_duplicated_case_numbers = True
domain_object.save()