def post(self, skey): key = self.request.arguments.get("key", '') value = self.request.arguments.get("value", '') Params(skey).add_queue(key, value) sinform.sinform_set(skey, "CONFIGUP") msg = { "message": "cfg_upd", "skey": skey } self.application.publisher.send(msg)
def onget(self): cmd = self.get_argument('cmd', '') if cmd == "params": empty = True params = Params.get(self.skey).all() for (k, v) in params.iteritems(): if v.has_key("queue"): self.write("PARAM %s %s\r\n" % (k, v["queue"])) empty = False self.write("FINISH\r\n") if empty: sinform.sinform_unset(self.skey, "CONFIGUP") elif cmd == 'cancel': Params.del_queueall(self.skey) sinform.sinform_unset(self.skey, "CONFIGUP") self.write("DELETED\r\n") msg = { "message": "cfg_upd", "skey": self.skey } self.application.publisher.send(msg) elif cmd == 'confirm': Params.confirm_queueall(self.skey) sinform.sinform_unset(self.skey, "CONFIGUP") self.write("CONFIRM") msg = { "message": "cfg_upd", "skey": self.skey } self.application.publisher.send(msg) elif cmd == 'check': empty = True params = Params.get(self.skey).all() for (k, v) in params.iteritems(): if v.has_key("queue"): empty = False if empty: sinform.sinform_unset(self.skey, "CONFIGUP") self.write('NODATA\r\n') else: sinform.sinform_set(self.skey, "CONFIGUP") self.write("CONFIGUP\r\n")
def onget(self): cmd = self.get_argument('cmd', '') if cmd == "params": empty = True params = Params.get(self.skey).all() for (k, v) in params.iteritems(): if v.has_key("queue"): self.write("PARAM %s %s\r\n" % (k, v["queue"])) empty = False self.write("FINISH\r\n") if empty: sinform.sinform_unset(self.skey, "CONFIGUP") elif cmd == 'cancel': Params.del_queueall(self.skey) sinform.sinform_unset(self.skey, "CONFIGUP") self.write("DELETED\r\n") msg = {"message": "cfg_upd", "skey": self.skey} self.application.publisher.send(msg) elif cmd == 'confirm': Params.confirm_queueall(self.skey) sinform.sinform_unset(self.skey, "CONFIGUP") self.write("CONFIRM") msg = {"message": "cfg_upd", "skey": self.skey} self.application.publisher.send(msg) elif cmd == 'check': empty = True params = Params.get(self.skey).all() for (k, v) in params.iteritems(): if v.has_key("queue"): empty = False if empty: sinform.sinform_unset(self.skey, "CONFIGUP") self.write('NODATA\r\n') else: sinform.sinform_set(self.skey, "CONFIGUP") self.write("CONFIGUP\r\n")