Ejemplo n.º 1
0
 def post(self, request):
     try:
         src_path = request.POST.get('src_path', '')  # 路径
         ip = request.META.get('HTTP_X_FORWARDED_FOR', request.META['REMOTE_ADDR'])
         respjson = delete_folder(src_path)
         if respjson['isSuccess']:
             thr_watchdog_folder('deleted', src_path, '1')  # 异步调用处理数据库还有权限
     except Exception as e:
         respjson = {'isSuccess': False, "message": str(src_path) + ";文件夹删除错误:" + str(e)}
     try:
         insert_folder_api_log(ip, str(respjson['isSuccess']), 'DeleteFolder', str(request.POST), str(respjson))
     except Exception as e:
         pass
     response = HttpResponse()
     response['Content-Type'] = "text/javascript"
     response.write(json.dumps(respjson, ensure_ascii=False))
     return response
Ejemplo n.º 2
0
 def on_deleted(self, event):
     thr_watchdog_folder('deleted', event.src_path, '1')
     print("directory deleted:{0}".format(event.src_path))
Ejemplo n.º 3
0
 def on_created(self, event):
     if event.is_directory:
         thr_watchdog_folder('created', event.src_path, '2')
         print("directory created:{0}".format(event.src_path))
Ejemplo n.º 4
0
 def on_moved(self, event):
     if event.is_directory:
         thr_watchdog_folder('moved',event.src_path,event.dest_path)
         print("directory moved from {0} to {1}".format(event.src_path,event.dest_path))