def removeDirectory(self, path): """ Remove the given directory. """ try: node = self.filesystem.fetch(self._makePath(path)) if not ivfs.IFileSystemContainer.providedBy(node): raise ftp.IsNotADirectoryError( "removeDirectory can only remove directories.") node.remove() except ivfs.VFSError, e: return vfsToFtpError(e)
def _got_child(child): if must_be_directory and not IDirectoryNode.providedBy(child): raise ftp.IsNotADirectoryError("rmdir called on a file") if must_be_file and IDirectoryNode.providedBy(child): raise ftp.IsADirectoryError("rmfile called on a directory") return parent.delete(childname)