From f871c3bb3ddc3b42c2851bb448d6c62a2ef6fac4 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Mon, 12 Oct 2009 18:45:46 -0700
Subject: [PATCH] dirnode.set_nodes: change return value: fire with self
 instead of None

---
 src/allmydata/dirnode.py           | 2 +-
 src/allmydata/interfaces.py        | 4 ++--
 src/allmydata/test/test_dirnode.py | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py
index 8dc9139c..4a2e751f 100644
--- a/src/allmydata/dirnode.py
+++ b/src/allmydata/dirnode.py
@@ -443,7 +443,7 @@ class DirectoryNode:
             return defer.fail(NotMutableError())
         a = Adder(self, entries, overwrite=overwrite)
         d = self._node.modify(a.modify)
-        d.addCallback(lambda res: None)
+        d.addCallback(lambda res: self)
         return d
 
 
diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index d2a93e3e..f07788f5 100644
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -926,8 +926,8 @@ class IDirectoryNode(IMutableFilesystemNode):
     def set_nodes(entries, overwrite=True):
         """Add multiple (name, child_node) pairs (or (name, child_node,
         metadata) triples) to a directory node. Returns a Deferred that fires
-        (with None) when the operation finishes. This is equivalent to
-        calling set_node() multiple times, but is much more efficient. All
+        (with this dirnode) when the operation finishes. This is equivalent
+        to calling set_node() multiple times, but is much more efficient. All
         child names must be unicode strings."""
 
 
diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py
index b4c2f760..c6841170 100644
--- a/src/allmydata/test/test_dirnode.py
+++ b/src/allmydata/test/test_dirnode.py
@@ -490,6 +490,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
                                                     (u"f3", n,
                                                      {"key": "value"}),
                                                     ]))
+            d.addCallback(lambda n2: self.failUnlessIdentical(n2, n))
             d.addCallback(lambda res:
                           self.shouldFail(ExistingChildError, "set_nodes-no",
                                           "child 'f1' already exists",
-- 
2.45.2