From 3e085efa7c2c775faa538bd8fc85596b64ede400 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 24 Dec 2006 12:47:03 -0700 Subject: [PATCH] filetable_new: fix the test --- src/allmydata/filetable_new.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) -- 2.45.2