(self, node, node_dict, recurse=True)
return node_dict
Recursive function to generate full search history tree.

        Args:
            node (SearchHistory): SearchHistory object as root node.
            node_dict (dict): Dictionary to use for recursion.
            recurse (bool): If the function should recurse on all children.

        Returns:
            Dictionary with a SearchHistory tree.
Recursive function to generate full search history tree.
Recursive function to generate full search history tree .
def build_tree(self, node, node_dict, recurse=True):
        """Recursive function to generate full search history tree.

        Args:
            node (SearchHistory): SearchHistory object as root node.
            node_dict (dict): Dictionary to use for recursion.
            recurse (bool): If the function should recurse on all children.

        Returns:
            Dictionary with a SearchHistory tree.
        """
        if not isinstance(node_dict, dict):
            raise ValueError('node_dict must be a dictionary')

        node_dict = self.build_node_dict(node_dict, node)
        children = node.children.values()
        if children and recurse:
            for child in children:
                child_dict = {}
                child.build_tree(child, child_dict)
                node_dict['children'].append(child_dict)
        else:
            return node_dict

        return node_dict
def build_tree ( self , node , node_dict , recurse = True ) : if not isinstance ( node_dict , dict ) : raise ValueError ( 'node_dict must be a dictionary' ) node_dict = self . build_node_dict ( node_dict , node ) children = node . children . values ( ) if children and recurse : for child in children : child_dict = { } child . build_tree ( child , child_dict ) node_dict [ 'children' ] . append ( child_dict ) else : return node_dict return node_dict