summaryrefslogtreecommitdiff
path: root/fs/ftpfs.py
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2010-02-16 00:27:08 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2010-02-16 00:27:08 +0000
commit660f4c74c7ba1b54405ef0a467df0d5a122fd891 (patch)
treed8d39dc623b61195bf2ada7c3c6e592e919fd140 /fs/ftpfs.py
parent012495ddd5eb73e5e9481644d303549cc31e98c5 (diff)
downloadpyfilesystem-660f4c74c7ba1b54405ef0a467df0d5a122fd891.tar.gz
ensure that rename() raises ParentDirectoryMissingError when appropriate
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@326 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/ftpfs.py')
-rw-r--r--fs/ftpfs.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ftpfs.py b/fs/ftpfs.py
index 060b72d..1092e95 100644
--- a/fs/ftpfs.py
+++ b/fs/ftpfs.py
@@ -927,6 +927,8 @@ class FTPFS(FS):
code = int(code)
if code == 550:
raise ResourceNotFoundError(path)
+ if code == 552:
+ raise StorageSpaceError
raise PermissionDeniedError(str(exception), path=path, msg="FTP error: %s (see details)" % str(exception), details=exception)
raise exception
@@ -1067,6 +1069,11 @@ class FTPFS(FS):
self.clear_dircache(dirname(src), dirname(dst), src, dst)
try:
self.ftp.rename(_encode(src), _encode(dst))
+ except error_perm, exception:
+ code, message = str(exception).split(' ', 1)
+ if code == "550":
+ if not self.exists(dirname(dst)):
+ raise ParentDirectoryMissingError(dst)
except error_reply:
pass