summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/sftp_attr.py16
-rw-r--r--paramiko/sftp_client.py2
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