summaryrefslogtreecommitdiff
path: root/fs/wrapfs
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2011-01-28 06:12:15 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2011-01-28 06:12:15 +0000
commit494d39d8adb58493288831ca0b70ea73c9e589ea (patch)
tree30b04d098fd0a13afd9dde26f6986df4bf9667d1 /fs/wrapfs
parent5cc66ff27bbc1236f0eef3a544041d35a9ec63de (diff)
downloadpyfilesystem-git-494d39d8adb58493288831ca0b70ea73c9e589ea.tar.gz
Make WrapFS.__str__ include details of the wrapped fs
Diffstat (limited to 'fs/wrapfs')
-rw-r--r--fs/wrapfs/__init__.py7
-rw-r--r--fs/wrapfs/lazyfs.py7
-rw-r--r--fs/wrapfs/subfs.py4
3 files changed, 11 insertions, 7 deletions
diff --git a/fs/wrapfs/__init__.py b/fs/wrapfs/__init__.py
index 2fafb08..80c20cb 100644
--- a/fs/wrapfs/__init__.py
+++ b/fs/wrapfs/__init__.py
@@ -117,6 +117,13 @@ class WrapFS(FS):
"""
return (mode,mode)
+ def __unicode__(self):
+ return u"<%s: %s>" % (self.__class__.__name__,self.wrapped_fs,)
+
+ def __str__(self):
+ return unicode(self).encode(sys.getdefaultencoding(),"replace")
+
+
@rewrite_errors
def getmeta(self, meta_name, default=NoDefaultMeta):
return self.wrapped_fs.getmeta(meta_name, default)
diff --git a/fs/wrapfs/lazyfs.py b/fs/wrapfs/lazyfs.py
index 50b14ac..10ec304 100644
--- a/fs/wrapfs/lazyfs.py
+++ b/fs/wrapfs/lazyfs.py
@@ -36,12 +36,9 @@ class LazyFS(WrapFS):
try:
wrapped_fs = self.__dict__["wrapped_fs"]
except KeyError:
- return u"<LazyFS wrapping %s>" % (self._fsclass,)
+ return u"<LazyFS: %s>" % (self._fsclass,)
else:
- return u"<LazyFS wrapping %s>" % (wrapped_fs,)
-
- def __str__(self):
- return unicode(self).encode(sys.getdefaultencoding(),"replace")
+ return u"<LazyFS: %s>" % (wrapped_fs,)
def __getstate__(self):
state = super(LazyFS,self).__getstate__()
diff --git a/fs/wrapfs/subfs.py b/fs/wrapfs/subfs.py
index 973e906..f834e44 100644
--- a/fs/wrapfs/subfs.py
+++ b/fs/wrapfs/subfs.py
@@ -31,10 +31,10 @@ class SubFS(WrapFS):
def __str__(self):
#return self.wrapped_fs.desc(self.sub_dir)
- return '<SubFS: %s%s>' % (self.wrapped_fs, self.sub_dir)
+ return '<SubFS: %s/%s>' % (self.wrapped_fs, self.sub_dir)
def __unicode__(self):
- return u'<SubFS: %s%s>' % (self.wrapped_fs, self.sub_dir)
+ return u'<SubFS: %s/%s>' % (self.wrapped_fs, self.sub_dir)
def __repr__(self):
return str(self)