diff options
author | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2009-07-17 04:12:53 +0000 |
---|---|---|
committer | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2009-07-17 04:12:53 +0000 |
commit | a98d792e5e5eeae7c8738e1d30ba948f4c3ff98b (patch) | |
tree | 187f9f137976a52a9a7dc7e7376fc6f2926f2b0e /fs/mountfs.py | |
parent | 6ccc57ecc2cae7e381d6f5529f3fe9fdcb6221e6 (diff) | |
download | pyfilesystem-a98d792e5e5eeae7c8738e1d30ba948f4c3ff98b.tar.gz |
delegate xattr methods in MountFS
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@221 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/mountfs.py')
-rw-r--r-- | fs/mountfs.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/mountfs.py b/fs/mountfs.py index 26ed376..82a59ac 100644 --- a/fs/mountfs.py +++ b/fs/mountfs.py @@ -255,3 +255,44 @@ class MountFS(FS): return fs.getinfo(delegate_path).get("size", None) + @synchronize + def getxattr(self,path,name,default=None): + path = normpath(path) + fs, mount_path, delegate_path = self._delegate(path) + if fs is None: + raise ResourceNotFoundError(path) + if fs is self: + return default + return fs.getxattr(delegate_path,name,default) + + @synchronize + def setxattr(self,path,name,value): + path = normpath(path) + fs, mount_path, delegate_path = self._delegate(path) + if fs is None: + raise ResourceNotFoundError(path) + if fs is self: + raise UnsupportedError("setxattr") + return fs.setxattr(delegate_path,name,value) + + @synchronize + def delxattr(self,path,name): + path = normpath(path) + fs, mount_path, delegate_path = self._delegate(path) + if fs is None: + raise ResourceNotFoundError(path) + if fs is self: + return True + return fs.delxattr(delegate_path,name) + + @synchronize + def listxattrs(self,path): + path = normpath(path) + fs, mount_path, delegate_path = self._delegate(path) + if fs is None: + raise ResourceNotFoundError(path) + if fs is self: + return [] + return fs.listxattrs(delegate_path) + + |