MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / delete

Method delete

web/pgadmin/misc/file_manager/__init__.py:1063–1086  ·  view source on GitHub ↗

Delete file or folder

(self, path=None)

Source from the content-addressed store, hash-verified

1061 }
1062
1063 def delete(self, path=None):
1064 """
1065 Delete file or folder
1066 """
1067 if not self.validate_request('delete'):
1068 return unauthorized(self.ERROR_NOT_ALLOWED['Error'])
1069 if self.shared_dir:
1070 the_dir = self.shared_dir
1071 else:
1072 the_dir = self.dir if self.dir is not None else ''
1073 orig_path = "{0}{1}".format(the_dir, path)
1074
1075 Filemanager.check_access_permission(the_dir, path)
1076
1077 try:
1078 if os.path.isdir(orig_path):
1079 os.rmdir(orig_path)
1080 else:
1081 os.remove(orig_path)
1082 except OSError as e:
1083 return internal_server_error("{0} {1}".format(
1084 gettext('There was an error deleting the file:'), e.strerror))
1085
1086 return make_json_response(status=200)
1087
1088 def add(self, req=None):
1089 """

Callers 15

cleanupAutoUpdateFlagFunction · 0.45
clear_arguments_sqliteFunction · 0.45
close_debuggerMethod · 0.45
delete_functionFunction · 0.45
close_debuggerFunction · 0.45
runTestMethod · 0.45
change_ownerFunction · 0.45
delete_roleFunction · 0.45
delete_userFunction · 0.45
deleteRowFunction · 0.45
onDeleteClickFunction · 0.45
saveMethod · 0.45

Calls 7

validate_requestMethod · 0.95
unauthorizedFunction · 0.90
internal_server_errorFunction · 0.90
make_json_responseFunction · 0.90
gettextFunction · 0.85
removeMethod · 0.45

Tested by 15

close_debuggerMethod · 0.36
runTestMethod · 0.36
_close_query_toolMethod · 0.36
_close_query_toolMethod · 0.36
_close_query_toolMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36
tearDownMethod · 0.36
_close_query_toolMethod · 0.36
tearDownMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36