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