Commit 39ef2b67 by willmcgugan

Changed DeleteRootError to RemoveRootError for consistency

parent 60da3d53
......@@ -18,7 +18,7 @@ __all__ = ['FSError',
'PermissionDeniedError',
'FSClosedError',
'OperationTimeoutError',
'DeleteRootError',
'RemoveRootError',
'ResourceError',
'NoSysPathError',
'NoMetaError',
......@@ -120,8 +120,8 @@ class OperationTimeoutError(OperationFailedError):
default_message = "Unable to %(opname)s: operation timed out"
class DeleteRootError(OperationFailedError):
default_message = "Can't delete root dir"
class RemoveRootError(OperationFailedError):
default_message = "Can't remove root dir"
class ResourceError(FSError):
......
......@@ -1300,7 +1300,7 @@ class FTPFS(FS):
if self.isfile(path):
raise ResourceInvalidError(path)
if normpath(path) in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
if not force:
for _checkpath in self.listdir(path):
......
......@@ -452,7 +452,7 @@ class MemoryFS(FS):
def removedir(self, path, recursive=False, force=False):
path = normpath(path)
if path in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
dir_entry = self._get_dir_entry(path)
if dir_entry is None:
......@@ -469,13 +469,13 @@ class MemoryFS(FS):
rpathname, dirname = pathsplit(rpathname)
parent_dir = self._get_dir_entry(rpathname)
if not dirname:
raise DeleteRootError(path)
raise RemoveRootError(path)
del parent_dir.contents[dirname]
else:
pathname, dirname = pathsplit(path)
parent_dir = self._get_dir_entry(pathname)
if not dirname:
raise DeleteRootError(path)
raise RemoveRootError(path)
del parent_dir.contents[dirname]
@synchronize
......
......@@ -332,7 +332,7 @@ class MountFS(FS):
def removedir(self, path, recursive=False, force=False):
path = normpath(path)
if path in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
fs, _mount_path, delegate_path = self._delegate(path)
if fs is self or fs is None:
raise ResourceInvalidError(path, msg="Can not removedir for an un-mounted path")
......
......@@ -294,7 +294,7 @@ class MultiFS(FS):
if self.writefs is None:
raise OperationFailedError('removedir', path=path, msg="No writeable FS set")
if normpath(path) in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
self.writefs.removedir(path, recursive=recursive, force=force)
@synchronize
......
......@@ -287,7 +287,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
pass
# Don't remove the root directory of this FS
if path in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
os.rmdir(sys_path)
# Using os.removedirs() for this can result in dirs being
# removed outside the root of this FS, so we recurse manually.
......
......@@ -497,7 +497,7 @@ class S3FS(FS):
def removedir(self,path,recursive=False,force=False):
"""Remove the directory at the given path."""
if normpath(path) in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
s3path = self._s3path(path)
if s3path != self._prefix:
s3path = s3path + self._separator
......
......@@ -476,7 +476,7 @@ class SFTPFS(FS):
def removedir(self,path,recursive=False,force=False):
npath = self._normpath(path)
if normpath(path) in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
if force:
for path2 in self.listdir(path,absolute=True):
try:
......
......@@ -841,7 +841,7 @@ class FSTestCases(object):
self.assertTrue(cmp_datetimes(d2, info['modified_time']))
def test_removeroot(self):
self.assertRaises(DeleteRootError, self.fs.removedir, "/")
self.assertRaises(RemoveRootError, self.fs.removedir, "/")
# May be disabled - see end of file
class ThreadingTestCases(object):
......
......@@ -20,7 +20,7 @@ import stat
from fs.mountfs import MountFS
from fs.path import pathjoin
from fs.errors import DestinationExistsError, DeleteRootError
from fs.errors import DestinationExistsError, RemoveRootError
from fs.base import FS
def copyfile(src_fs, src_path, dst_fs, dst_path, overwrite=True, chunk_size=64*1024):
......@@ -206,7 +206,7 @@ def movedir(fs1, fs2, create_destination=True, ignore_errors=False, chunk_size=6
print fs1
if parent_dir1 in ('', '/'):
raise DeleteRootError(dir1)
raise RemoveRootError(dir1)
if isinstance(fs2, tuple):
fs2, dir2 = fs2
......
......@@ -61,7 +61,7 @@ class SubFS(WrapFS):
# Careful not to recurse outside the subdir
path = normpath(path)
if path in ('', '/'):
raise DeleteRootError(path)
raise RemoveRootError(path)
super(SubFS,self).removedir(path,force=force)
if recursive:
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment