示例#1
0
文件: server.py 项目: benroeder/swftp
    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
示例#2
0
文件: server.py 项目: Libreno/swftp
    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
示例#3
0
    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