diff options
author | Robey Pointer <robey@lag.net> | 2004-11-07 02:51:42 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2004-11-07 02:51:42 +0000 |
commit | 920df7d0ae14dfcca92b4a952b84fa40e7c71222 (patch) | |
tree | 2848153cc2aa70afff731a08e91b566455f09a92 | |
parent | 2f3228dd88a81e037a43bd0f990e2558da853056 (diff) |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-108]
add filename to SFTPAttributes
add filename to the attributes stored in an SFTPAttributes object.
-rw-r--r-- | paramiko/sftp_attr.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index a4e97943..90bf8d7e 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -54,13 +54,15 @@ class SFTPAttributes (object): self._flags = 0 self.attr = {} - def from_stat(cls, obj): + def from_stat(cls, obj, filename=None): """ Create an SFTPAttributes object from an existing C{stat} object (an object returned by C{os.stat}). @param obj: an object returned by C{os.stat} (or equivalent). @type obj: object + @param filename: the filename associated with this file. + @type filename: str @return: new L{SFTPAttributes} object with the same attribute fields. @rtype: L{SFTPAttributes} """ @@ -71,6 +73,8 @@ class SFTPAttributes (object): attr.st_mode = obj.st_mode attr.st_atime = obj.st_atime attr.st_mtime = obj.st_mtime + if filename is not None: + attr.filename = filename return attr from_stat = classmethod(from_stat) |