summaryrefslogtreecommitdiff
path: root/fs/tempfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-23 18:29:17 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-23 18:29:17 +0000
commitf64112a54c9d0d8044d5a0b1c2a260c5dc13a1b8 (patch)
treea28e540dab80032bf33b1013edb4ed766374fab0 /fs/tempfs.py
parenta32a775d84e3b74430c74b7b881523c3f9d08aa2 (diff)
downloadpyfilesystem-git-f64112a54c9d0d8044d5a0b1c2a260c5dc13a1b8.tar.gz
Fixes for fsmount
Diffstat (limited to 'fs/tempfs.py')
-rw-r--r--fs/tempfs.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/tempfs.py b/fs/tempfs.py
index 380b76f..d1af95e 100644
--- a/fs/tempfs.py
+++ b/fs/tempfs.py
@@ -56,14 +56,20 @@ class TempFS(OSFS):
def __unicode__(self):
return u'<TempFS: %s>' % self._temp_dir
- def __setstate__(self, state):
- """Pickle the TempFS. TempFS delted their contents when closed, so pickling
- is not garanteed to preserve the directory contents"""
- state = super(TempFS, self).__setstate__(state)
- self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
- super(TempFS, self).__init__(self._temp_dir,
- dir_mode=self.dir_mode,
- thread_synchronize=self.thread_synchronize)
+ def __getstate__(self):
+ # If we are picking a TempFS, we want to preserve its contents,
+ # so we *don't* do the clean
+ state = super(TempFS, self).__getstate__()
+ self._cleaned = True
+ return state
+
+ def __setstate__(self, state):
+ state = super(TempFS, self).__setstate__(state)
+ self._cleaned = False
+ #self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
+ #super(TempFS, self).__init__(self._temp_dir,
+ # dir_mode=self.dir_mode,
+ # thread_synchronize=self.thread_synchronize)
def close(self):
"""Removes the temporary directory.