Commit cbe06da6 authored by Enrico Zini's avatar Enrico Zini
Browse files

Allow to create reusing existing tree elements

parent 8f324ba1
......@@ -684,11 +684,14 @@ class MockTree(Tree):
def lcreate(self, path, value=None):
if not path: return super(MockTree, self).lcreate(path, value)
subtree = MockTree(path[0])
if self.is_leaf:
subtree = MockTree(path[0])
self.value = { path[0]: subtree }
self.value[path[0]] = subtree
subtree = self.value.get(path[0], None)
if subtree is None:
subtree = MockTree(path[0])
self.value[path[0]] = subtree
if len(path) == 1:
subtree.lset([], value)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment