Exemplo n.º 1
0
 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("about") 
     return render.about(title, header, footer)
Exemplo n.º 2
0
    def POST(self, args):
        postData = web.input()
        ip = postData.get("ip")
        port = postData.get("port")
        filter = postData.get("filter")
        filter_path = postData.get("filter_path")

        userlog.addLog(
            web.ctx.ip, self.__class__.__name__ + " " + get_cur_fun_name(),
            web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol + ":" +
            str(ip) + ":" + str(port) + ":" + str(filter) + ":" +
            str(filter_path))

        if filter_path == "filter":
            service_filter_dict, provider_ip_dict, consumer_address_dict = getAllServiceProviderConsumer(
                ip, port, filter, None)
            return json.dumps([
                sorted(service_filter_dict.keys()),
                sorted(provider_ip_dict.keys()),
                sorted(consumer_address_dict.keys())
            ])
        else:
            service_filter_dict, _, _ = getAllServiceProviderConsumer(
                ip, port, None, filter)
            return json.dumps(sorted(service_filter_dict))
 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();
     operate = postData.get("operate");
     trans_code = postData.get("trans_code")
     format_code = postData.get("format_code")
     c_format = postData.get("c_format")
     send_example = postData.get("send_example")
     recv_example = postData.get("recv_example")  
           
     if operate == "insert":
         #新插入一天记录到数据库
         transformat.insertDB(trans_code,
             format_code,
             c_format ,
             send_example ,
             recv_example ,)  
         pass
     elif operate == "update" :
         #更新数据库
         transformat.updateDB(trans_code,
             format_code,
             c_format ,
             send_example ,
             recv_example ,)            
         pass
     elif operate == "delete":
         transformat.deleteDB(trans_code,)
     
     title, header, footer = getHeaderFooter("editformat")
     allformats = transformat.readEPTransForamt()
     return render.editformat(title, header, footer, None, None, None, allformats)
Exemplo n.º 4
0
    def POST(self, args):
        postData = web.input()
        ip = postData.get("ip")
        port = postData.get("port")
        keyFilter = postData.get("filter")

        userlog.addLog(
            web.ctx.ip,
            self.__class__.__name__ + " " + get_cur_fun_name(),
            web.ctx.path
            + ":"
            + web.ctx.query
            + ":"
            + web.ctx.protocol
            + ":"
            + str(ip)
            + ":"
            + str(port)
            + ":"
            + str(keyFilter),
        )

        result = getRedisKeyValues(ip, port, keyFilter)

        logging.info(str(result))

        return json.dumps(result)
        pass
Exemplo n.º 5
0
 def GET(self, args=None):
     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("base64") 
     return render.base64Page(title, header, footer, None, None)      
 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("editformat")
     allformats = transformat.readEPTransForamt()
     return render.editformat(title, header, footer, None, None, None, 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)
     
     logging.info("client ip " + str(web.ctx.ip))
     title, header, footer = getHeaderFooter("generateXMLAndJavaCodePage")
     return render.generateXMLAndJavaCodePage(title, header, footer)
Exemplo n.º 8
0
 def POST(self, args=None):
     postData = web.input();
     identNo = postData.get("identNo");
     
     userlog.addLog(web.ctx.ip,
                    self.__class__.__name__ + " " + get_cur_fun_name(),
                    web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol + identNo)
             
     return self.ic.check(identNo)
Exemplo n.º 9
0
    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 = compareTwoXml(postData.get("left_xml"), postData.get("right_xml"))
        title, header, footer = getHeaderFooter("xmlcompare")
        twoXml = {"left_xml":postData.get("left_xml"), "right_xml":postData.get("right_xml")}
        return render.xmlcompare(title, header, footer, diff_dict, same_dict, twoXml)
 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()
     format, left, right = postData.get("format"), postData.get("left_string"), postData.get("right_string")
     
     resultList = stringCompare(format, left, right)
     title, header, footer = getHeaderFooter("stringcompare")
     twoString = {"left_string":left, "right_string":right}
     
     allformats = transformat.readEPTransForamt_stream()
     return render.stringcompare(title, header, footer, format, resultList, twoString, allformats)
Exemplo n.º 11
0
    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 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()
     gen = Generate()
     
     zipFileName, filenameList = gen.gen(postData)
     
     zipFileName = zipFileName.replace("\\", "/")
     logging.info(zipFileName)
     print zipFileName
     
     title, header, footer = getHeaderFooter("generateXMLAndJavaCodePage")
     return render.generateXMLAndJavaCodePageResult(title, header, footer, zipFileName, filenameList)
Exemplo n.º 13
0
    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("xmlcompare")
        twoXml = {
                  "left_xml":"""<ap>
    <pwd>left</pwd>
    <cardNo>6228480010007632</cardNo>
    <same>the same</same>
</ap>""",
                    "right_xml":"""<ap>
    <pwd>right</pwd>
    <cardNo></cardNo>
    <same>the same</same>
</ap> """}        
        return render.xmlcompare(title, header, footer, None, None, twoXml)
Exemplo n.º 14
0
 def POST(self, args=None):
     postData = web.input();
     string = postData.get("string");
     direction = postData.get("direction")
     
     userlog.addLog(web.ctx.ip,
                    self.__class__.__name__ + " " + get_cur_fun_name(),
                    web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol + direction + string.replace(" ", "").replace("\t", ""))
     
     if direction == "encode":
         return base64lib.b64encode(string)
         pass
     else:
         try:
             plainText = base64lib.b64decode(string)
             return plainText
         except Exception, e:
             return "异常" + str(e)
         pass
Exemplo n.º 15
0
    def POST(self, args):
        postData = web.input();
        clearAllMemcacheFlag = postData.get("clearAllMemcache");
        
        returnLog = ""
        if clearAllMemcacheFlag != None:
            userlog.addLog(web.ctx.ip, "clearMemcache", "all")
            
            #清理所有缓存
            returnLog = clearAllMemcache()
            #返回清理缓存的日志
            return returnLog
        

        userlog.addLog(web.ctx.ip,
                       self.__class__.__name__ + " " + get_cur_fun_name(),
                       web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol)        
        #正常的post  
        title, header, footer = getHeaderFooter("clearAllMemcachePage") 
        return render.clearAllMemcachePage(title, header, footer, returnLog, None) 
Exemplo n.º 16
0
    def POST(self, args):
        postData = web.input();
        clearAllMemcache = postData.get("clearAllMemcache");
        invokeDubboFlag = postData.get("invokeDubbo");
        
        returnLog = ""
        if clearAllMemcache != None:
            userlog.addLog(web.ctx.ip, "clearMemcache", "all")
            
            #清理所有缓存
            returnLog = clearMemcache.clearAllMemcache()
            #返回清理缓存的日志
            return returnLog
        
        invokeResult = ""
        if invokeDubboFlag != None:
            host = postData.get("host");
            port = int(postData.get("port"));
            cmd = postData.get("cmd");
            advance = postData.get("advance");
            replaceStr = postData.get("replaceStr");
            argumentsValue = postData.get("argumentsValue");
            
            if advance == "true":
                cmds = []
                argumentsValue = eval(argumentsValue)
                for arguments in argumentsValue:
                    #替换所有的双引号为单引号,去掉开头和末尾的"[", "]"
                    arguments = str(arguments).replace('"', "'")[1:-1]
            
                    cmdFinal = cmd.replace(replaceStr, arguments)
                    #记录日志
                    userlog.addLog(web.ctx.ip, "invoke dubbo host:%s, port:%s" % (host, port), cmdFinal)          
                    cmds.append(cmdFinal)
                invokeResult = invokeDubboMultiCmd(host, port, cmds)
                pass
            else:
                userlog.addLog(web.ctx.ip, "invoke dubbo host:%s, port:%s" % (host, port), cmd)
                invokeResult = invokeDubbo(host, port, cmd)
                print "$%s$" % invokeResult
                pass
                        
            #返回invoke结果
            return invokeResult

        userlog.addLog(web.ctx.ip,
                       self.__class__.__name__ + " " + get_cur_fun_name(),
                       web.ctx.path + ":" + web.ctx.query + ":" + web.ctx.protocol)        
        #正常的post  
        title, header, footer = getHeaderFooter("telnetDubboPage") 
        return render.telnetDubboPage(title, header, footer, returnLog, invokeResult) 
 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)
     
     x = web.input(myfile={})
     web.debug(x['myfile'].filename) # 这里是文件名
     gen = Generate()
     xmlDir, goalDir, dataDirName = gen.getXmlDirGoalDirDataDirName(x['myfile'].filename + ".")
     #上传的文件,写入到goalDir
     os.chdir(dataDirName)
     os.chdir(goalDir)
     print goalDir
     file(x['myfile'].filename, "w").write(x['myfile'].value)
     os.chdir("../..")
     zipFileName, filenameList = gen.genJavaCode(xmlDir, goalDir, dataDirName) 
     
     zipFileName = zipFileName.replace("\\", "/")
     title, header, footer = getHeaderFooter("upload")
     return render.uploadResult(title, header, footer, zipFileName, filenameList)
     pass
 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("stringcompare")
     format = """
 2 headLen
 3   firstField    
 4 nocomment
 5 
 6
     """
     left = "12345678901234"
     right = """12345678904321"""
     twoString = {"left_string":left, "right_string":right}
     
     resultList = None
     
     allformats = transformat.readEPTransForamt_stream()
             
     return render.stringcompare(title, header, footer, format, resultList, twoString, allformats)
Exemplo n.º 19
0
 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)