fix: 修复短信问题

This commit is contained in:
xinwen
2021-09-10 14:39:02 +08:00
committed by Jiangjie.Bai
parent 345c0fcf4f
commit 3e737c8cb8
2 changed files with 7 additions and 1 deletions

View File

@@ -67,6 +67,12 @@ class SMS:
client: BaseSMSClient
def __init__(self, backend=None):
backend = backend or settings.SMS_BACKEND
if backend not in BACKENDS:
raise JMSException(
code='sms_provider_not_support',
detail=_('SMS provider not support: {}').format(backend)
)
m = importlib.import_module(f'.{backend or settings.SMS_BACKEND}', __package__)
self.client = m.client.new_from_settings()