fixes from mike barber for chdir and sftp attr __str__
This commit is contained in:
Robey Pointer 2006-09-07 19:39:59 -07:00
parent 305a4ae417
commit 4acb9589ce
2 changed files with 13 additions and 5 deletions

View File

@ -86,9 +86,6 @@ class SFTPAttributes (object):
def __repr__(self): def __repr__(self):
return '<SFTPAttributes: %s>' % self._debug_str() return '<SFTPAttributes: %s>' % self._debug_str()
def __str__(self):
return self._debug_str()
### internals... ### internals...
@ -210,5 +207,14 @@ class SFTPAttributes (object):
else: else:
datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime)) datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime))
filename = getattr(self, 'filename', '?') 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)

View File

@ -657,6 +657,8 @@ class SFTPClient (BaseSFTP):
if (len(path) > 0) and (path[0] == '/'): if (len(path) > 0) and (path[0] == '/'):
# absolute path # absolute path
return path return path
if self._cwd == '/':
return self._cwd + path
return self._cwd + '/' + path return self._cwd + '/' + path