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)
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.
+import os
from cStringIO import StringIO
import urlparse, httplib
import allmydata # for __full_version__
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))
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")