diff options
author | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-12-23 02:20:16 +0000 |
---|---|---|
committer | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-12-23 02:20:16 +0000 |
commit | 1c7a928c994cc7500904c118e7fe66cd8e6f4083 (patch) | |
tree | 24f5a9a3533a67ec6049c9a3c501d024787235b5 /fs/tempfs.py | |
parent | 5489ce993e1f3870e9c15af97817b7b1f39fb595 (diff) | |
download | pyfilesystem-git-1c7a928c994cc7500904c118e7fe66cd8e6f4083.tar.gz |
Small optimization
Diffstat (limited to 'fs/tempfs.py')
-rw-r--r-- | fs/tempfs.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/tempfs.py b/fs/tempfs.py index 793a29c..380b76f 100644 --- a/fs/tempfs.py +++ b/fs/tempfs.py @@ -7,6 +7,7 @@ Make a temporary file system that exists in a folder provided by the OS. All fil """ import os +import os.path import time import tempfile @@ -23,7 +24,8 @@ class TempFS(OSFS): _meta = { 'virtual' : False, 'read_only' : False, 'unicode_paths' : os.path.supports_unicode_filenames, - 'case_insensitive_paths' : os.path.normcase('Aa') == 'aa', + 'case_insensitive_paths' : os.path.normcase('Aa') == 'aa', + 'pickle_contents': False, 'network' : False, 'atomic.move' : True, 'atomic.copy' : True, @@ -55,7 +57,9 @@ class TempFS(OSFS): return u'<TempFS: %s>' % self._temp_dir def __setstate__(self, state): - state = super(TempFS, self).__setstate__(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, |