예제 #1
0
 def post(self, path, rfile, headers):
     form = cgi.FieldStorage(fp=rfile,
                             headers=headers,
                             environ={
                                 'REQUEST_METHOD': 'POST',
                                 'CONTENT_TYPE': headers['Content-Type'],
                             })
     filename = form.getvalue("file-name")
     try:
         data = {"result": "success"}
         Util.delete_file(filename)
         self.server.send_response(200)
         self.server.send_header('Content-type', 'application/json')
         self.server.end_headers()
         self.server.wfile.write(json.dumps(data))
     except Exception as E:
         print E
         self.server.send_response(403)
         self.server.send_header('Content-type', 'application/json')
         self.server.end_headers()
예제 #2
0
 def delete_file_event(self):
     view = self.listFile
     fileName = view.currentItem().text()
     util.delete_file(fileName)
     self.load_log(retFlag=0)