summaryrefslogtreecommitdiff
path: root/paramiko/sftp_attr.py
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2006-09-07 19:39:59 -0700
committerRobey Pointer <robey@lag.net>2006-09-07 19:39:59 -0700
commit4acb9589ced5a05d9f52f7fcb0f3f8630cb37c71 (patch)
treec9e0b095c5d3c8ed407a36c145944f7fd495e6bb /paramiko/sftp_attr.py
parent305a4ae417089a17e6314055e37c4d74b1ecc978 (diff)
downloadparamiko-4acb9589ced5a05d9f52f7fcb0f3f8630cb37c71.tar.gz
[project @ robey@lag.net-20060908023959-de70f0675f25fa64]
fixes from mike barber for chdir and sftp attr __str__
Diffstat (limited to 'paramiko/sftp_attr.py')
-rw-r--r--paramiko/sftp_attr.py16
1 files changed, 11 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)
+