fix announces subscription by sms

This commit is contained in:
Thomas NOËL 2013-03-05 18:17:58 +01:00
parent 00e0f4da23
commit 02bd79d553
1 changed files with 6 additions and 4 deletions

View File

@ -200,7 +200,7 @@ class AnnouncesDirectory(Directory):
if sms_mode == 'demo':
TextsDirectory.get_html_text('aq-sms-demo')
elif sms_mode == 'mobyt':
else:
announces_cfg = get_cfg('announces',{})
mobile_mask = announces_cfg.get('mobile_mask')
if mobile_mask:
@ -262,11 +262,13 @@ class AnnouncesDirectory(Directory):
token.subscription_id = sub.id
token.store()
message = _("Confirmation code : %s" % token.id)
message = _("Confirmation code : %s") % str(token.id)
sms_cfg = get_cfg('sms', {})
sms = SMS()
sender = sms_cfg.get('sender', 'AuQuotidien')
mode = sms_cfg.get('mode', 'none')
sms = SMS.get_sms_class(mode)
try:
sms.send([mobile], message, sms_cfg.get('sender', 'auquotidien'))
sms.send(sender, [mobile], message)
except errors.SMSError, e:
get_logger().error(e)
form.set_error("mobile", _("Send SMS confirmation failed"))