From: Brian Warner Date: Sun, 24 Dec 2006 19:47:03 +0000 (-0700) Subject: filetable_new: fix the test X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~421 X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/simplejson/?a=commitdiff_plain;h=3e085efa7c2c775faa538bd8fc85596b64ede400;p=tahoe-lafs%2Ftahoe-lafs.git filetable_new: fix the test --- diff --git a/src/allmydata/filetable_new.py b/src/allmydata/filetable_new.py index 0ab130fb..215da26c 100644 --- a/src/allmydata/filetable_new.py +++ b/src/allmydata/filetable_new.py @@ -265,13 +265,19 @@ class _SubTreeMixin(object): class _MutableSubTreeMixin(object): def add(self, path, child, opener, work_queue): - d = self.find_lowest_containing_subtree_for_path(path, opener) + assert len(path) > 0 + d = self.find_lowest_containing_subtree_for_path(path[:-1], opener) def _found(res): subtree, prepath, postpath = res assert IMutableSubTree.providedBy(subtree) + # postpath is from the top of the subtree to the directory where + # this child should be added. add_subpath wants the path from the + # top of the subtree to the child itself, so we need to append + # the child's name here. + addpath = postpath + [path[-1]] # this add_path will cause some steps to be added, as well as the # internal node to be modified - d1 = subtree.add_subpath(postpath, child, work_queue) + d1 = subtree.add_subpath(addpath, child, work_queue) if subtree.mutation_affects_parent(): def _added(boxname): work_queue.add_addpath(boxname, prepath)