summaryrefslogtreecommitdiff
path: root/fs/memoryfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-10-31 18:26:06 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-10-31 18:26:06 +0000
commitccfc728c67c84e9a419a178396172543b97c4261 (patch)
tree5eb016d05437057eeb7daec2dd9a5c71f82beb05 /fs/memoryfs.py
parent307c3729ba7ba9a0417628975e104ae44d073c4c (diff)
downloadpyfilesystem-git-ccfc728c67c84e9a419a178396172543b97c4261.tar.gz
Added a check to the MemoryFS constructor that throws a ValueError if file_factory is not callable
Diffstat (limited to 'fs/memoryfs.py')
-rw-r--r--fs/memoryfs.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/memoryfs.py b/fs/memoryfs.py
index c9e0e71..38244ad 100644
--- a/fs/memoryfs.py
+++ b/fs/memoryfs.py
@@ -196,6 +196,8 @@ class MemoryFS(FS):
self.dir_entry_factory = DirEntry
self.file_factory = file_factory or MemoryFile
+ if not callable(self.file_factory):
+ raise ValueError("file_factory should be callable")
self.root = self._make_dir_entry('dir', 'root')