def openFile(self, fullpath, flags, attrs): self.log_command('openFile', fullpath, flags, attrs) f = SwiftFile(self, fullpath, flags=flags, attrs=attrs) d = f.checkExistance() def errback(failure): failure.trap(NotFound) raise SFTPError(FX_FAILURE, "Container Doesn't Exist") d.addCallback(lambda r: f) d.addErrback(errback) return d
def openFile(self, fullpath, flags, attrs): """ Open File/Object. Checks for Object Existence :param str fullpath: path to an object :param flags: flags to open the object with :param dict attrs: extra attributes to open the object with """ self.log_command('openFile', fullpath, flags, attrs) f = SwiftFile(self, fullpath, flags=flags, attrs=attrs) d = f.checkExistance() def errback(failure): failure.trap(NotFound) raise SFTPError(FX_FAILURE, "Container Doesn't Exist") d.addCallback(lambda r: f) d.addErrback(errback) return d