summaryrefslogtreecommitdiff
path: root/fs/memoryfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-07-11 21:34:57 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-07-11 21:34:57 +0000
commitd11ab72b4de221270f38215f387bbf0b7e04ba85 (patch)
tree134577fe73437c8f0c2dde4ce8d194b09390ce1a /fs/memoryfs.py
parent35091f1593b567a493976d289b89a8cf79fb0948 (diff)
downloadpyfilesystem-d11ab72b4de221270f38215f387bbf0b7e04ba85.tar.gz
Modified listdir and walk to take callables in addition to wildcards
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@381 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/memoryfs.py')
-rw-r--r--fs/memoryfs.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/memoryfs.py b/fs/memoryfs.py
index 6ecb95a..a435f0e 100644
--- a/fs/memoryfs.py
+++ b/fs/memoryfs.py
@@ -306,8 +306,9 @@ class MemoryFS(FS):
parent_dir.contents[dirname] = self._make_dir_entry("dir", dirname)
+ @synchronize
def _orphan_files(self, file_dir_entry):
- for f in file_dir_entry.open_files:
+ for f in file_dir_entry.open_files[:]:
f.close()
@synchronize
@@ -414,7 +415,6 @@ class MemoryFS(FS):
parent_dir = self._get_dir_entry(pathname)
del parent_dir.contents[dirname]
-
@synchronize
def rename(self, src, dst):
src_dir,src_name = pathsplit(src)
@@ -441,7 +441,7 @@ class MemoryFS(FS):
dst_dir_entry.xattrs.update(src_xattrs)
del src_dir_entry.contents[src_name]
-
+ @synchronize
def settimes(self, path, accessed_time=None, modified_time=None):
now = datetime.datetime.now()
if accessed_time is None:
@@ -456,7 +456,6 @@ class MemoryFS(FS):
return True
return False
-
@synchronize
def _on_close_memory_file(self, open_file, path, value):
dir_entry = self._get_dir_entry(path)
@@ -473,8 +472,7 @@ class MemoryFS(FS):
@synchronize
def _on_modify_memory_file(self, path):
dir_entry = self._get_dir_entry(path)
- dir_entry.modified_time = datetime.datetime.now()
-
+ dir_entry.modified_time = datetime.datetime.now()
@synchronize
def listdir(self, path="/", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False):