Jonatan Cloutier has proposed merging 
lp:~jonatan-cloutier/python-webdav-lib/fixInRamFileSize into 
lp:python-webdav-lib.

Requested reviews:
  DataFinderTeam (datafinder-team)
Related bugs:
  Bug #1190316 in Python WebDAV Library: "File size check fail when using a in 
ram file"
  https://bugs.launchpad.net/python-webdav-lib/+bug/1190316

For more details, see:
https://code.launchpad.net/~jonatan-cloutier/python-webdav-lib/fixInRamFileSize/+merge/169023

This fix a problem when sending a file that is only in ram
-- 
https://code.launchpad.net/~jonatan-cloutier/python-webdav-lib/fixInRamFileSize/+merge/169023
Your team DataFinderTeam is requested to review the proposed merge of 
lp:~jonatan-cloutier/python-webdav-lib/fixInRamFileSize into 
lp:python-webdav-lib.
=== modified file 'src/webdav/Connection.py'
--- src/webdav/Connection.py	2012-12-21 17:59:38 +0000
+++ src/webdav/Connection.py	2013-06-12 18:00:38 +0000
@@ -179,9 +179,11 @@
         try:
             # Assemble header
             try:
-                size = os.path.getsize(srcfile.name)    
+                srcfile.seek(0,2)
+                size = srcfile.tell()
+                srcfile.seek(0,0)   
             except os.error, error:
-                raise WebdavError("Cannot determine file size.\nReason: ''" % str(error.args))
+                raise WebdavError("Cannot determine file size.\nReason: '%s'" % str(error.args))
             header["Content-length"] = str(size)
             
             contentType, contentEnc = mimetypes.guess_type(path)

_______________________________________________
Mailing list: https://launchpad.net/~datafinder-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~datafinder-team
More help   : https://help.launchpad.net/ListHelp

Antwort per Email an