return tuple(elements)
class Deleter:
- def __init__(self, node, name):
+ def __init__(self, node, name, must_exist=True):
self.node = node
self.name = name
+ self.must_exist = True
def modify(self, old_contents):
children = self.node._unpack_contents(old_contents)
if self.name not in children:
+ if self.must_exist:
+ raise KeyError(self.name)
self.old_child = None
return None
self.old_child, metadata = children[self.name]
self.all_contents[self.storage_index] = new_contents
return defer.succeed(None)
def modify(self, modifier):
+ return defer.maybeDeferred(self._modify, modifier)
+ def _modify(self, modifier):
assert not self.is_readonly()
old_contents = self.all_contents[self.storage_index]
self.all_contents[self.storage_index] = modifier(old_contents)
- return defer.succeed(None)
+ return None
def make_mutable_file_uri():