update many dirnode interfaces to accept dict-of-nodes instead of dict-of-caps

interfaces.py: define INodeMaker, document argument values, change
               create_new_mutable_directory() to take dict-of-nodes. Change
               dirnode.set_nodes() and dirnode.create_subdirectory() too.
nodemaker.py: use INodeMaker, update create_new_mutable_directory()
client.py: have create_dirnode() delegate initial_children= to nodemaker
dirnode.py (Adder): take dict-of-nodes instead of list-of-nodes, which
                    updates set_nodes() and create_subdirectory()
web/common.py (convert_initial_children_json): create dict-of-nodes
web/directory.py: same
web/unlinked.py: same
test_dirnode.py: update tests to match
This commit is contained in:
Brian Warner
2009-10-17 12:28:29 -07:00
parent 8a7c980e37
commit b4ec86c95a
8 changed files with 87 additions and 66 deletions

View File

@ -458,9 +458,7 @@ class Client(node.Node, pollmixin.PollMixin):
return self.nodemaker.create_from_cap(writecap, readcap)
def create_dirnode(self, initial_children={}):
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)
return d
def create_mutable_file(self, contents=None, keysize=None):