From: Brian Warner Date: Tue, 13 Oct 2009 03:19:22 +0000 (-0700) Subject: The initial_children= argument to nodemaker.create_new_mutable_directory is X-Git-Tag: trac-4100~16 X-Git-Url: https://git.rkrishnan.org/%5B/index.php?a=commitdiff_plain;h=480e1d318dd4661902e343dfd94405ead512a06f;p=tahoe-lafs%2Ftahoe-lafs.git The initial_children= argument to nodemaker.create_new_mutable_directory is now enabled. --- diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index ba6d5528..dfb2f1b5 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -479,9 +479,7 @@ class DirectoryNode: assert isinstance(name, unicode) if self.is_readonly(): return defer.fail(NotMutableError()) - d = self._nodemaker.create_new_mutable_directory() - if initial_children: - d.addCallback(lambda n: n.set_children(initial_children)) + d = self._nodemaker.create_new_mutable_directory(initial_children) def _created(child): entries = [(name, child, None)] a = Adder(self, entries, overwrite=overwrite) diff --git a/src/allmydata/nodemaker.py b/src/allmydata/nodemaker.py index 01fdd72a..8a0baf43 100644 --- a/src/allmydata/nodemaker.py +++ b/src/allmydata/nodemaker.py @@ -89,8 +89,8 @@ class NodeMaker: return d def create_new_mutable_directory(self, initial_children={}): - if initial_children: - raise NotImplementedError("initial_children= not implemented yet") d = self.create_mutable_file() d.addCallback(self._create_dirnode) + if initial_children: + d.addCallback(lambda n: n.set_children(initial_children)) return d