lib/menu.py
author Tero Marttila <terom@fixme.fi>
Sat, 07 Feb 2009 02:12:32 +0200
changeset 12 2abc5ace0b15
parent 11 fa216534ae45
child 13 178ea40bbc44
permissions -rw-r--r--
basic multi-level menu
"""
    Handling the list of available pages
"""

# for page_list
from page import page_tree as _page_tree

class Menu (object) :
    """
        Contains info needed to render the menu
    """

    def __init__ (self, page) :
        """
            Gather the menu information for the given page
        """

        # the selected page
        self.page = _page_tree.get_page(page.url)

        # the selected pagen's inheritance
        self.ancestry = self.page.get_ancestry()
        
        # list of menu items == page siblings
        self.items = _page_tree.root.children