workflows: zap empty sms recipients (#6930)
This commit is contained in:
parent
a4f43de039
commit
2fc4aadda0
|
@ -1408,6 +1408,11 @@ class SendSMSWorkflowStatusItem(WorkflowStatusItem):
|
|||
if not self.body:
|
||||
return
|
||||
|
||||
destinations = [self.compute(x) for x in self.to]
|
||||
destinations = [x for x in destinations if x] # ignore empty elements
|
||||
if not destinations:
|
||||
return
|
||||
|
||||
try:
|
||||
sms_body = template_on_formdata(formdata, self.compute(self.body))
|
||||
except ezt.EZTException:
|
||||
|
@ -1415,13 +1420,13 @@ class SendSMSWorkflowStatusItem(WorkflowStatusItem):
|
|||
get_logger().error('error in template for sms [%s], sms could not be generated' % url)
|
||||
return
|
||||
|
||||
from qommon.sms import SMS
|
||||
import qommon.sms
|
||||
|
||||
sms_cfg = get_cfg('sms', {})
|
||||
sender = sms_cfg.get('sender', 'AuQuotidien')[:11]
|
||||
mode = sms_cfg.get('mode', 'none')
|
||||
try:
|
||||
SMS.get_sms_class(mode).send(sender, [self.compute(x) for x in self.to], sms_body[:160])
|
||||
qommon.sms.SMS.get_sms_class(mode).send(sender, destinations, sms_body[:160])
|
||||
except qommon.errors.SMSError, e:
|
||||
get_logger().error(e)
|
||||
|
||||
|
|
Loading…
Reference in New Issue