diff options
author | Robey Pointer <robey@lag.net> | 2006-09-07 19:39:59 -0700 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2006-09-07 19:39:59 -0700 |
commit | 4acb9589ced5a05d9f52f7fcb0f3f8630cb37c71 (patch) | |
tree | c9e0b095c5d3c8ed407a36c145944f7fd495e6bb | |
parent | 305a4ae417089a17e6314055e37c4d74b1ecc978 (diff) |
[project @ robey@lag.net-20060908023959-de70f0675f25fa64]
fixes from mike barber for chdir and sftp attr __str__
-rw-r--r-- | paramiko/sftp_attr.py | 16 | ||||
-rw-r--r-- | paramiko/sftp_client.py | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index 6a861b5d..bdbda90d 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -86,9 +86,6 @@ class SFTPAttributes (object): def __repr__(self): return '<SFTPAttributes: %s>' % self._debug_str() - def __str__(self): - return self._debug_str() - ### internals... @@ -210,5 +207,14 @@ class SFTPAttributes (object): else: datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime)) filename = getattr(self, 'filename', '?') - return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, self.st_uid, self.st_gid, - self.st_size, datestr, filename) + + # not all servers support uid/gid + uid = self.st_uid + gid = self.st_gid + if uid is None: + uid = 0 + if gid is None: + gid = 0 + + return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename) + diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index b31a1b4c..6fa1cd93 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -657,6 +657,8 @@ class SFTPClient (BaseSFTP): if (len(path) > 0) and (path[0] == '/'): # absolute path return path + if self._cwd == '/': + return self._cwd + path return self._cwd + '/' + path |