]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
stringutils.py, sftpd.py: Portability fixes for Python <= 2.5.
authordavid-sarah <david-sarah@jacaranda.org>
Wed, 9 Jun 2010 01:33:02 +0000 (18:33 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Wed, 9 Jun 2010 01:33:02 +0000 (18:33 -0700)
src/allmydata/frontends/sftpd.py
src/allmydata/util/stringutils.py

index 5d54962ba16533067959aa66fe41f91a61d1db09..975b6c4dc704214aa041c0cc1c0e0d4f8843df6c 100644 (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)
 
index d5c20865d3c97bcf001e13883ccd82bd5e49846f..bce2868d0af18681e6772077bdb71a4d42508a3a 100644 (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