Download existing path, truncate and reupload

def truncate(self, path, length, fh=None):
        "Download existing path, truncate and reupload"
        try:
            f = self._getpath(path)
        except JFS.JFSError:
            raise OSError(errno.ENOENT, '')
        if isinstance(f, (JFS.JFSFile, JFS.JFSFolder)) and f.is_deleted():
            raise OSError(errno.ENOENT)
        data = StringIO(f.read())
        data.truncate(length)
        try:
            self.client.up(path, data) # replace file contents
            self._dirty(path)
            return ESUCCESS
        except:
            raise OSError(errno.ENOENT, '')