stringutils.py, sftpd.py: Portability fixes for Python <= 2.5.

This commit is contained in:
david-sarah 2010-06-08 18:33:02 -07:00
parent 28ed28a0c2
commit 80a89d3931
2 changed files with 2 additions and 2 deletions

View File

@ -311,7 +311,7 @@ class EncryptedTemporaryFile(PrefixingLogMixin):
def flush(self):
self.file.flush()
def seek(self, offset, whence=os.SEEK_SET):
def seek(self, offset, whence=0): # 0 = SEEK_SET
if noisy: self.log(".seek(%r, %r)" % (offset, whence), level=NOISY)
self.file.seek(offset, whence)

View File

@ -25,7 +25,7 @@ def _canonical_encoding(encoding):
# fail early if this happens
try:
u"test".encode(encoding)
except LookupError:
except (LookupError, AttributeError):
raise AssertionError("The character encoding '%s' is not supported for conversion." % (encoding,))
return encoding