コード例 #1
0
ファイル: views.py プロジェクト: xisafe/ITportal
 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
コード例 #2
0
 def on_deleted(self, event):
     thr_watchdog_folder('deleted', event.src_path, '1')
     print("directory deleted:{0}".format(event.src_path))
コード例 #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))
コード例 #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))