diff options
author | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-12-28 07:22:29 +0000 |
---|---|---|
committer | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-12-28 07:22:29 +0000 |
commit | 9b71922a5889803baca622c2da7bf83a2491cad4 (patch) | |
tree | 1e981cf606eb63c7d67da1c24381384f97987d57 /fs/wrapfs | |
parent | aa5d170355bd9905665cbe2ac752a3f05f3616cc (diff) | |
download | pyfilesystem-git-9b71922a5889803baca622c2da7bf83a2491cad4.tar.gz |
fix interaction between WrapFS._file_wrap and WrapFS.setcontents
Diffstat (limited to 'fs/wrapfs')
-rw-r--r-- | fs/wrapfs/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/wrapfs/__init__.py b/fs/wrapfs/__init__.py index 9b02aeb..df831e6 100644 --- a/fs/wrapfs/__init__.py +++ b/fs/wrapfs/__init__.py @@ -145,7 +145,13 @@ class WrapFS(FS): @rewrite_errors def setcontents(self, path, data, chunk_size=64*1024): - return self.wrapped_fs.setcontents(self._encode(path), data, chunk_size=chunk_size) + # We can't pass setcontents() through to the wrapped FS if the + # wrapper has defined a _file_wrap method, as it would bypass + # the file contents wrapping. + if self._file_wrap.im_func is WrapFS._file_wrap.im_func: + return self.wrapped_fs.setcontents(self._encode(path), data, chunk_size=chunk_size) + else: + return super(WrapFS,self).setcontents(path, data, chunk_size) @rewrite_errors def createfile(self, path): |