summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/common.py7
-rw-r--r--paramiko/logging22.py3
-rw-r--r--paramiko/sftp_attr.py18
3 files changed, 17 insertions, 11 deletions
diff --git a/paramiko/common.py b/paramiko/common.py
index 360b804a..c5999e68 100644
--- a/paramiko/common.py
+++ b/paramiko/common.py
@@ -105,8 +105,11 @@ except:
# the above will likely fail on Windows - fall back to non-persistent random pool
randpool = RandomPool()
-randpool.randomize()
-
+try:
+ randpool.randomize()
+except:
+ # earlier versions of pyCrypto (pre-2.0) don't have randomize()
+ pass
import sys
if sys.version_info < (2, 3):
diff --git a/paramiko/logging22.py b/paramiko/logging22.py
index e21b1548..ac11a733 100644
--- a/paramiko/logging22.py
+++ b/paramiko/logging22.py
@@ -43,6 +43,9 @@ class logger (object):
def addHandler(self, h):
self.handlers.append(h)
+ def addFilter(self, filter):
+ pass
+
def log(self, level, text):
if level >= self.level:
for h in self.handlers:
diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py
index 05ebcf72..eae7c993 100644
--- a/paramiko/sftp_attr.py
+++ b/paramiko/sftp_attr.py
@@ -171,8 +171,8 @@ class SFTPAttributes (object):
def __str__(self):
"create a unix-style long description of the file (like ls -l)"
- if hasattr(self, 'permissions'):
- kind = self.permissions & stat.S_IFMT
+ if hasattr(self, 'st_mode'):
+ kind = stat.S_IFMT(self.st_mode)
if kind == stat.S_IFIFO:
ks = 'p'
elif kind == stat.S_IFCHR:
@@ -189,15 +189,15 @@ class SFTPAttributes (object):
ks = 's'
else:
ks = '?'
- ks += _rwx((self.permissions & 0700) >> 6, self.permissions & stat.S_ISUID)
- ks += _rwx((self.permissions & 070) >> 3, self.permissions & stat.S_ISGID)
- ks += _rwx(self.permissions & 7, self.permissions & stat.S_ISVTX, True)
+ ks += self._rwx((self.st_mode & 0700) >> 6, self.st_mode & stat.S_ISUID)
+ ks += self._rwx((self.st_mode & 070) >> 3, self.st_mode & stat.S_ISGID)
+ ks += self._rwx(self.st_mode & 7, self.st_mode & stat.S_ISVTX, True)
else:
ks = '?---------'
- uid = getattr(self, 'uid', -1)
- gid = getattr(self, 'gid', -1)
- size = getattr(self, 'size', -1)
- mtime = getattr(self, 'mtime', 0)
+ uid = getattr(self, 'st_uid', -1)
+ gid = getattr(self, 'st_gid', -1)
+ size = getattr(self, 'st_size', -1)
+ mtime = getattr(self, 'st_mtime', 0)
# compute display date
if abs(time.time() - mtime) > 15552000:
# (15552000 = 6 months)