Exemplo n.º 1
0
 def post(self, *args, **kwargs):
     result = tornado.escape.json_decode(self.request.body)
     print(type(result))
     print("result:", result)
     json_trans.json_modified("handlers/upload/file.json",result)
     print("数据提交成功!")
     self.render('test.html')
Exemplo n.º 2
0
    def post(self, *args, **kwargs):

        result = tornado.escape.json_decode(self.request.body)
        try:
            json_trans.json_modified("handlers/upload/file.json",result)
            print("数据提交成功!")
            self.render('Finish.html')
        except FileNotFoundError:
            print("-----------------文件没找到")
Exemplo n.º 3
0
    def post(self, *args, **kwargs):

        json_files = self.request.files.get('json_file', None)
        if json_files:
            for json_file in json_files:
                with open('./handlers/upload/file.json', 'wb') as f:
                    f.write(json_file['body'])
            self.redirect('action')
        else:
            try:
                result = tornado.escape.json_decode(self.request.body)
            except json.decoder.JSONDecodeError:
                self.redirect('action')
                return

            try:
                json_trans.json_modified("handlers/upload/file.json", result)
                print("数据提交成功!")
                self.render('Finish.html')
            except FileNotFoundError:
                print("-----------------文件没找到")