rql_download.twistedserver.server.CubicWebProxiedSFTPServer¶
-
class
rql_download.twistedserver.server.
CubicWebProxiedSFTPServer
(avatar)[source]¶ Implements the authorized actions on the sftp server.
Methods
__init__
(avatar)extendedRequest
(*args, **kwargs)getAttrs
(path, followLinks)Return the attributes for the given path. gotVersion
(otherVersion, extData)makeDirectory
(*args, **kwargs)makeLink
(*args, **kwargs)openDirectory
(path)Open a directory for scanning. openFile
(filename, flags, attrs)Called when the clients asks to open a file. readLink
(*args, **kwargs)realPath
(path)Convert any path to an absolute path. removeDirectory
(*args, **kwargs)removeFile
(*args, **kwargs)renameFile
(*args, **kwargs)setAttrs
(*args, **kwargs)-
__module__
= 'rql_download.twistedserver.server'¶
-
getAttrs
(path, followLinks)[source]¶ Return the attributes for the given path.
This method returns a dictionary in the same format as the attrs argument to openFile or a Deferred that is called back with same.
Parameters: path: str (mandatory) :
the path to return attributes for as a string.
followLinks: bool (mandatory) :
If it is True, follow symbolic links.
Returns: out: dict :
If it ‘followLinks’ is True, follow symbolic links and return attributes for the real path at the base. If it is False, return attributes for the specified path.
-
openDirectory
(path)[source]¶ Open a directory for scanning.
This method returns an iterable object that has a close() method, or a Deferred that is called back with same.
The close() method is called when the client is finished reading from the directory. At this point, the iterable will no longer be used.
The iterable should return triples of the form (filename, longname, attrs) or Deferreds that return the same. The sequence must support __getitem__, but otherwise may be any ‘sequence-like’ object.
filename is the name of the file relative to the directory. logname is an expanded format of the filename. The recommended format is: -rwxr-xr-x 1 mjos staff 348911 Mar 25 14:29 t-filexfer 1234567890 123 12345678 12345678 12345678 123456789012
The first line is sample output, the second is the length of the field. The fields are: permissions, link count, user owner, group owner, size in bytes, modification time.
attrs is a dictionary in the format of the attrs argument to openFile.
Parameters: path: str (mandatory) :
the directory to open.
-
openFile
(filename, flags, attrs)[source]¶ Called when the clients asks to open a file.
Note
There is no way to indicate text or binary files. It is up to the SFTP client to deal with this.
Parameters: filename: str (mandatory) :
a string representing the file to open.
flags: int (mandatory) :
an integer of the flags to open the file with, ORed together. The flags and their values are listed at the bottom of this file.
attrs: list (mandatory) :
a list of attributes to open the file with. It is a dictionary, consisting of 0 or more keys. The possible keys are:
- size: the size of the file in bytes
- uid: the user ID of the file as an integer
- gid: the group ID of the file as an integer
- permissions: the permissions of the file with as an integer.
- the bit representation of this field is defined by POSIX.
- atime: the access time of the file as seconds since the epoch.
- mtime: the modification time of the file as seconds since the epoch.
- ext_*: extended attributes. The server is not required to understand this, but it may.
Returns: out: object :
an object that meets the ISFTPFile interface. Alternatively, it can return a L{Deferred} that will be called back with the object.
-