Commits

Victor Gavro committed b76eb99

fixed undocumented sms-gateway behavior, fixed admin message on sms send

Comments (0)

Files changed (2)

   def save_formset(self, request, form, formset, change):
     instances = formset.save()
     if settings.SEND_ON_SAVE and instances:
-      instances[0].sms.send()
-    messages.info(request,_('SMS sent to %s recipients'))
+      count = instances[0].sms.send()
+    messages.info(request,_('SMS sent to %s recipients') % count)
 
 def sms_recipient_get_status(self, request, queryset):
   count = SmsRecipient.get_statuses(recipients=queryset)

smsgate/backends/mssgbox_com/http_v1.py

 
 def sendMsg(message,recipient_list,sender,**options):
   options.update({'to': recipient_list,'text': message,'from': sender,})
-  regexp = '(ERR|ID): ([0-9a-f]+) To: (\d+)' if len(recipient_list) > 1 else '(ERR|ID): ([0-9a-f]+)'
+  #commented out - because not working as documented
+  #regexp = '(ERR|ID): ([0-9a-f]+) To: (\d+)' if len(recipient_list) > 1 else '(ERR|ID): ([0-9a-f]+)'
+  regexp = '(ERR|ID): ([0-9a-f]+)'
   match_all = parse(send_command('sendMsg',**options),regexp)
 
   result = []
   for match in match_all:
-    #TODO Assuming that recipient statuses returned with same order as we posted them
     if match[0] == 'ERR':
       result.append((None,STATUS_UNSENT,ERROR_CODES.get(match[1],u'Unknown code: %s' % match[1])))
     else: