def cmdhistory(request): callback=request.GET.get('callback') cmd_history=cache.get('cmd_history') if not cmd_history: info={"msgtype":"OK","content":[],"totalnum":0} else: info=pagelist(request,cmd_history) for t in info["content"]: cmd_result_id="cmd.%s.%s" % (t['tid'],t['servers']) if cmd_result_id is None:continue cmd_result=redis_to_redis.get_redis_data(cmd_result_id,'list')['content'] info["content"].remove(t) t["result"]=re.sub("""\\"|\\'""",'',"</br>".join(cmd_result)) print type(cmd_result) info["content"].append(t) info=json.dumps(info,encoding="utf-8",ensure_ascii=False) if callback is None: info=info else: info="%s(%s)" % (callback,info) response=HttpResponse(info) response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Methods"] = "POST" response["Access-Control-Allow-Credentials"] = "true" return response
def cmdhistory(request): callback=request.GET.get('callback') cmd_history=cache.get('cmd_history') if not cmd_history: info={"msgtype":"OK","content":[],"totalnum":0} else: info=pagelist(request,cmd_history) T=[] for t in info['content']: cmd_result_id="cmd.%s.%s" % (t['tid'],t['servers']) cmd_result=redis_to_redis.get_redis_data(cmd_result_id,'list')['content'] t["result"]=re.sub("""\\"|\\'""",'',"</br>".join(cmd_result)) T.append(t) info['content']=T info=json.dumps(info,encoding="utf-8",ensure_ascii=False) if callback is None: info=info else: info="%s(%s)" % (callback,info) response=HttpResponse(info) response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Methods"] = "POST" response["Access-Control-Allow-Credentials"] = "true" return response
def show_sign_record(request): callback=request.GET.get('callback') datainfo=redis_to_redis.get_redis_data('sign.record','list') info=pagelist(request,datainfo["content"]) info=json.dumps(info,encoding="utf-8",ensure_ascii=False) if callback is None: info=info else: info="%s(%s)" % (callback,info) response=HttpResponse(info) response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Methods"] = "POST" response["Access-Control-Allow-Credentials"] = "true" return response