def action(self):
     try:
         # do stuff with the message
         message_id = send_message(shared.twilio_sid, shared.twilio_token, self.pid)
         self.twilio_id = message_id
         self.date_sent = datetime.now()
         self.sent = True
     except:
         # something happened and we got an error... do nothing with this message.
         pass
 def action(self):
     # for debouncing purposes
     self.twilio_retry_send = 'Ran'
     pending_messages = Message.filter(sent=False, sms_direction='')
     for message in pending_messages:
         try:
             # do stuff with message
             message_id = send_message(shared.twilio_sid, shared.twilio_token, message.pid)
             message.twilio_id = message_id
             message.date_sent = datetime.now()
             message.sent = True
             message.save()
         except:
             # something happened and we got an error... do nothing with this message.
             pass