summaryrefslogtreecommitdiff
path: root/fs/wrapfs
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2011-12-26 20:52:33 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2011-12-26 20:52:33 +0000
commitb0885a312f4f57c67758850be245db5a34e5c71f (patch)
treeb332b5ce21a5842eea21fa68a627c859d12234d2 /fs/wrapfs
parentfafea9afc1fc576062c5c8070ec46ace8183be49 (diff)
downloadpyfilesystem-b0885a312f4f57c67758850be245db5a34e5c71f.tar.gz
First stab at a Python3 port
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@724 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/wrapfs')
-rw-r--r--fs/wrapfs/__init__.py9
-rw-r--r--fs/wrapfs/limitsizefs.py2
-rw-r--r--fs/wrapfs/subfs.py2
3 files changed, 7 insertions, 6 deletions
diff --git a/fs/wrapfs/__init__.py b/fs/wrapfs/__init__.py
index 6cb2b0e..2f5fe21 100644
--- a/fs/wrapfs/__init__.py
+++ b/fs/wrapfs/__init__.py
@@ -120,8 +120,8 @@ class WrapFS(FS):
def __unicode__(self):
return u"<%s: %s>" % (self.__class__.__name__,self.wrapped_fs,)
- def __str__(self):
- return unicode(self).encode(sys.getdefaultencoding(),"replace")
+ #def __str__(self):
+ # return unicode(self).encode(sys.getdefaultencoding(),"replace")
@rewrite_errors
@@ -155,10 +155,11 @@ class WrapFS(FS):
# 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:
+ #if self._file_wrap.im_func is WrapFS._file_wrap.im_func:
+ if getattr(self.__class__, '_file_wrap', None) is getattr(WrapFS, '_file_wrap', None):
return self.wrapped_fs.setcontents(self._encode(path), data, chunk_size=chunk_size)
else:
- return super(WrapFS,self).setcontents(path, data, chunk_size)
+ return super(WrapFS,self).setcontents(path, data, chunk_size=chunk_size)
@rewrite_errors
def createfile(self, path):
diff --git a/fs/wrapfs/limitsizefs.py b/fs/wrapfs/limitsizefs.py
index 50c161f..45a5fcf 100644
--- a/fs/wrapfs/limitsizefs.py
+++ b/fs/wrapfs/limitsizefs.py
@@ -95,7 +95,7 @@ class LimitSizeFS(WrapFS):
def setcontents(self, path, data, chunk_size=64*1024):
f = None
try:
- f = self.open(path, 'w')
+ f = self.open(path, 'wb')
if hasattr(data, 'read'):
chunk = data.read(chunk_size)
while chunk:
diff --git a/fs/wrapfs/subfs.py b/fs/wrapfs/subfs.py
index 2ae1ab7..79b1e58 100644
--- a/fs/wrapfs/subfs.py
+++ b/fs/wrapfs/subfs.py
@@ -37,7 +37,7 @@ class SubFS(WrapFS):
return u'<SubFS: %s/%s>' % (self.wrapped_fs, self.sub_dir.lstrip('/'))
def __repr__(self):
- return str(self)
+ return "SubFS(%r, %r)" % (self.wrapped_fs, self.sub_dir)
def desc(self, path):
if path in ('', '/'):