def move_collection(self, destination): """Called to move a resource to a new location. Overwrite is assumed, the DAV server will refuse to move to an existing resource otherwise. This method needs to gracefully handle a pre-existing destination of any type.""" for child in self.get_children(): child.move(self.clone(safe_join(destination.get_path(), child.displayname))) self.delete()
def copy_collection(self, destination, depth=-1): """Called to copy a resource to a new location. Overwrite is assumed, the DAV server will refuse to copy to an existing resource otherwise. This method needs to gracefully handle a pre-existing destination of any type. It also needs to respect the depth parameter. depth == -1 is infinity.""" # If depth is less than 0, then it started out as -1. # We need to keep recursing until we hit 0, or forever # in case of infinity. if depth != 0: for child in self.get_children(): child.copy(self.clone(safe_join(destination.get_path(), child.displayname)), depth=depth-1)