dirnode.py: add metadata= to add_file(), add tests

This commit is contained in:
Brian Warner
2008-02-11 14:53:28 -07:00
parent b90eaf75da
commit e6ddd9f3da
2 changed files with 113 additions and 5 deletions

View File

@ -298,7 +298,7 @@ class NewDirectoryNode:
return d
def add_file(self, name, uploadable):
def add_file(self, name, uploadable, metadata=None):
"""I upload a file (using the given IUploadable), then attach the
resulting FileNode to the directory at the given name. I return a
Deferred that fires (with the IFileNode of the uploaded file) when
@ -308,7 +308,7 @@ class NewDirectoryNode:
d = self._client.upload(uploadable)
d.addCallback(lambda results: results.uri)
d.addCallback(self._client.create_node_from_uri)
d.addCallback(lambda node: self.set_node(name, node))
d.addCallback(lambda node: self.set_node(name, node, metadata))
return d
def delete(self, name):