]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Since we now require Python 2.5, we can use os.SEEK_END.
authordavid-sarah <david-sarah@jacaranda.org>
Wed, 16 May 2012 21:39:48 +0000 (21:39 +0000)
committerdavid-sarah <david-sarah@jacaranda.org>
Wed, 16 May 2012 21:39:48 +0000 (21:39 +0000)
src/allmydata/immutable/upload.py
src/allmydata/mutable/publish.py
src/allmydata/scripts/common_http.py
src/allmydata/test/test_util.py

index 013aca97cbc6a9ce2c221531cc9e444f5bfdd33e..27c4b5ca19524a9f4e351fcf99ad34c1a358eae2 100644 (file)
@@ -1363,7 +1363,7 @@ class FileHandle(BaseUploadable):
     def get_size(self):
         if self._size is not None:
             return defer.succeed(self._size)
-        self._filehandle.seek(0,2)
+        self._filehandle.seek(0, os.SEEK_END)
         size = self._filehandle.tell()
         self._size = size
         self._filehandle.seek(0)
index c611a6f965fd3a3d52dfad75ef067c9160b85436..3b7c6e0595da443a62f6fbd841c74d28abf7d8d8 100644 (file)
@@ -1224,7 +1224,7 @@ class MutableFileHandle:
             old_position = self._filehandle.tell()
             # Seek to the end of the file by seeking 0 bytes from the
             # file's end
-            self._filehandle.seek(0, 2) # 2 == os.SEEK_END in 2.5+
+            self._filehandle.seek(0, os.SEEK_END)
             self._size = self._filehandle.tell()
             # Restore the previous position, in case this was called
             # after a read.
index 9ceb7a799513e9ad25ecf7545d3ed350f9057e31..66a6291cb5497e3ec89a60a990a5d2917525d860 100644 (file)
@@ -1,4 +1,5 @@
 
+import os
 from cStringIO import StringIO
 import urlparse, httplib
 import allmydata # for __full_version__
@@ -53,7 +54,7 @@ def do_http(method, url, body=""):
     c.putheader("Connection", "close")
 
     old = body.tell()
-    body.seek(0, 2)
+    body.seek(0, os.SEEK_END)
     length = body.tell()
     body.seek(old)
     c.putheader("Content-Length", str(length))
index f6a6f2ff27e719f20bed9fdfeffb8482e4053757..0db1a89b52bc1b38367205c94584d3798f8f4f71 100644 (file)
@@ -437,7 +437,7 @@ class FileUtil(unittest.TestCase):
         f.write("stuff.")
         f.close()
         f = fileutil.open_or_create(fn)
-        f.seek(0, 2)
+        f.seek(0, os.SEEK_END)
         f.write("more.")
         f.close()
         f = open(fn, "r")