'Create a tree of pages from their path.'

@classmethod
def get_listing(cls, sr, filter_check=None):

    page_tree = OrderedDict()
    pages = cls.get_pages(sr, filter_check=filter_check)
    pages = sorted(pages, key=(lambda page: page.name))
    for page in pages:
        p = page.name.split('/')
        cur_node = page_tree
        for name in p[:(-1)]:
            next_node = cur_node.get(name)
            if (not next_node):
                new_node = OrderedDict()
                cur_node[name] = [None, new_node]
            else:
                new_node = next_node[1]
            cur_node = new_node
        pagename = p[(-1)]
        node = cur_node.get(pagename)
        if node:
            node[0] = page
        else:
            cur_node[pagename] = [page, OrderedDict()]
    return (page_tree, pages)
