Document, FTP: handle case of move into existing name.
Unlike unix 'mv', we do not allow move to point to an existing 'new_name'. bzr revid: p_christ@hol.gr-20100714125232-fmm9sm1nc30nz92k
This commit is contained in:
parent
5a5608d71b
commit
6cb5fa01ed
|
@ -615,8 +615,6 @@ class node_dir(node_database):
|
|||
raise IOError(errno.EPERM, "Cannot move the root directory!")
|
||||
self.parent = self.context.get_dir_node(cr, dbro.parent_id.id)
|
||||
assert self.parent
|
||||
|
||||
# TODO: test if parent is writable.
|
||||
|
||||
if self.parent != ndir_node:
|
||||
logger.debug('Cannot move dir %r from %r to %r', self, self.parent, ndir_node)
|
||||
|
@ -624,6 +622,8 @@ class node_dir(node_database):
|
|||
|
||||
ret = {}
|
||||
if new_name and (new_name != dbro.name):
|
||||
if ndir_node.child(cr, new_name):
|
||||
raise IOError(errno.EEXIST, "Destination path already exists")
|
||||
ret['name'] = new_name
|
||||
|
||||
del dbro
|
||||
|
|
|
@ -403,7 +403,9 @@ class abstracted_fs(object):
|
|||
# API shouldn't wait for us to write the object
|
||||
assert (ret is True) or (ret is False)
|
||||
cr.commit()
|
||||
except Exception,err:
|
||||
except EnvironmentError:
|
||||
raise
|
||||
except Exception, err:
|
||||
self._log.exception('Cannot rename "%s" to "%s" at "%s"', src, datacr[2], datacr[1])
|
||||
raise OSError(1,'Operation not permited.')
|
||||
|
||||
|
|
|
@ -1464,6 +1464,7 @@ class FTPHandler(asynchat.async_chat):
|
|||
errno.EINVAL: 504,
|
||||
errno.ENOENT: 550,
|
||||
errno.EREMOTE: 450,
|
||||
errno.EEXIST: 521,
|
||||
}
|
||||
|
||||
# mlsx facts attributes
|
||||
|
|
Loading…
Reference in New Issue