(self)
return top
Return database with groups and entries organized into a
        hierarchy
Return database with groups and entries organized into a
        hierarchy
Return database with groups and entries organized into a hierarchy
def hierarchy(self):
        '''Return database with groups and entries organized into a
        hierarchy'''
        from hier import Node

        top = Node()
        breadcrumb = [top]
        node_by_id = {None:top}
        for group in self.groups:
            n = Node(group)
            node_by_id[group.groupid] = n

            while group.level - breadcrumb[-1].level() != 1:
                pn = breadcrumb.pop()
                continue

            breadcrumb[-1].nodes.append(n)
            breadcrumb.append(n)
            continue

        for ent in self.entries:
            n = node_by_id[ent.groupid]
            n.entries.append(ent)

        return top
def hierarchy ( self ) : from hier import Node top = Node ( ) breadcrumb = [ top ] node_by_id = { None : top } for group in self . groups : n = Node ( group ) node_by_id [ group . groupid ] = n while group . level - breadcrumb [ - 1 ] . level ( ) != 1 : pn = breadcrumb . pop ( ) continue breadcrumb [ - 1 ] . nodes . append ( n ) breadcrumb . append ( n ) continue for ent in self . entries : n = node_by_id [ ent . groupid ] n . entries . append ( ent ) return top