def POST(self, args): userlog.addLog(web.ctx.ip, self.__class__.__name__ + " " + get_cur_fun_name(), web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol) postData = web.input() diff_dict, same_dict = compareTwoJson(postData.get("left_json"), postData.get("right_json")) title, header, footer = getHeaderFooter("jsoncompare") twojson = {"left_json":json.dumps(json.loads(postData.get("left_json")), indent=4), "right_json":json.dumps(json.loads(postData.get("right_json")), indent=4)} allformats = transformat.readEPTransForamt_json() return render.jsoncompare(title, header, footer, diff_dict, same_dict, twojson, allformats)
def GET(self, args): userlog.addLog(web.ctx.ip, self.__class__.__name__ + " " + get_cur_fun_name(), web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol) title, header, footer = getHeaderFooter("jsoncompare") twoJson = { "left_json":"""{ "0":"123", "a":"", "b":1, "c":{ "d":"e" } }""", "right_json":""" { "a":"", "b":1, "c":{ "d":"ef" } }"""} allformats = transformat.readEPTransForamt_json() return render.jsoncompare(title, header, footer, None, None, twoJson, allformats)