summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-10-18 02:35:37 +0000
committerbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-10-18 02:35:37 +0000
commitd913814dd969892f2e3025f160fe4e488b3a98b5 (patch)
treefd7f9c1d4b133ef3163b2e6ebfd7670c76cd8106
parent7cf729db7156d588cee6ff40ce6eb19c7edd60cb (diff)
downloadpyfilesystem-d913814dd969892f2e3025f160fe4e488b3a98b5.tar.gz
__del__() is inherited from FS and redundant.
Synchronize the close() methods. Ensure the close() methods close and del referenced file systems. git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@823 67cdc799-7952-0410-af00-57a81ceafa0f
-rw-r--r--fs/contrib/archivefs.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/contrib/archivefs.py b/fs/contrib/archivefs.py
index d5dd69f..780f1bb 100644
--- a/fs/contrib/archivefs.py
+++ b/fs/contrib/archivefs.py
@@ -79,9 +79,6 @@ class ArchiveFS(FS):
else:
self.contents[part] = libarchive.Entry(pathname=part, mode=stat.S_IFDIR, size=0, mtime=item.mtime)
- def __del__(self):
- self.close()
-
def __str__(self):
return "<ArchiveFS: %s>" % self.root_path
@@ -93,6 +90,7 @@ class ArchiveFS(FS):
return self.read_only
return super(ArchiveFS, self).getmeta(meta_name, default)
+ @synchronize
def close(self):
if getattr(self, 'archive', None) is None:
return
@@ -185,10 +183,12 @@ class ArchiveMountFS(mountfs.MountFS):
self.rootfs = rootfs
self.mountdir('/', rootfs)
- def __del__(self):
- # Close (if requested by auto_close, why by default is True) when
- # de-referenced.
- self.close()
+ @synchronize
+ def close(self):
+ # Close and delete references to any other fs instances.
+ self.rootfs.close()
+ del self.rootfs
+ super(ArchiveMountFS, self).close()
def ismount(self, path):
"Checks if the given path has a file system mounted on it."