patch from wesley augur: expose the 'longname' field from listdir_attr().
This commit is contained in:
parent
920b172360
commit
3229cd0f94
|
@ -90,11 +90,13 @@ class SFTPAttributes (object):
|
|||
### internals...
|
||||
|
||||
|
||||
def _from_msg(cls, msg, filename=None):
|
||||
def _from_msg(cls, msg, filename=None, longname=None):
|
||||
attr = cls()
|
||||
attr._unpack(msg)
|
||||
if filename is not None:
|
||||
attr.filename = filename
|
||||
if longname is not None:
|
||||
attr.longname = longname
|
||||
return attr
|
||||
_from_msg = classmethod(_from_msg)
|
||||
|
||||
|
|
|
@ -137,6 +137,11 @@ class SFTPClient (BaseSFTP):
|
|||
not include the special entries C{'.'} and C{'..'} even if they are
|
||||
present in the folder.
|
||||
|
||||
The returned L{SFTPAttributes} objects will each have an additional
|
||||
field: C{longname}, which may contain a formatted string of the file's
|
||||
attributes, in unix format. The content of this string will probably
|
||||
depend on the SFTP server implementation.
|
||||
|
||||
@param path: path to list (defaults to C{'.'})
|
||||
@type path: str
|
||||
@return: list of attributes
|
||||
|
@ -163,7 +168,7 @@ class SFTPClient (BaseSFTP):
|
|||
for i in range(count):
|
||||
filename = _to_unicode(msg.get_string())
|
||||
longname = _to_unicode(msg.get_string())
|
||||
attr = SFTPAttributes._from_msg(msg, filename)
|
||||
attr = SFTPAttributes._from_msg(msg, filename, longname)
|
||||
if (filename != '.') and (filename != '..'):
|
||||
filelist.append(attr)
|
||||
self._request(CMD_CLOSE, handle)
|
||||
|
|
Loading…
Reference in New Issue