summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-09-09 21:14:57 +0000
committerwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-09-09 21:14:57 +0000
commitb51d5d2b3641204335d4247fe4f1321c52aafecc (patch)
tree966d98500f741edd529d1e13d1c25e113f91234f
parent5cb5166aa8e4a5296bd2e2029d5e804aa99f6ec2 (diff)
downloadpyfilesystem-b51d5d2b3641204335d4247fe4f1321c52aafecc.tar.gz
Fix for setcontents with empty string
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@874 67cdc799-7952-0410-af00-57a81ceafa0f
-rw-r--r--fs/base.py2
-rw-r--r--fs/tests/__init__.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/base.py b/fs/base.py
index b112c64..c1c363d 100644
--- a/fs/base.py
+++ b/fs/base.py
@@ -790,7 +790,7 @@ class FS(object):
if not data:
progress_callback(0)
- self.createfile(path)
+ self.createfile(path, wipe=True)
finished_callback()
return 0
diff --git a/fs/tests/__init__.py b/fs/tests/__init__.py
index aac08ce..9fd3cda 100644
--- a/fs/tests/__init__.py
+++ b/fs/tests/__init__.py
@@ -152,6 +152,8 @@ class FSTestCases(object):
b("to you, good sir!")), chunk_size=2)
self.assertEquals(self.fs.getcontents(
"hello", "rb"), b("to you, good sir!"))
+ self.fs.setcontents("hello", "", "wb")
+ self.assertEquals(self.fs.getcontents("hello", "rb"), "")
def test_setcontents_async(self):
# setcontents() should accept both a string...