lib/menu.py
author Tero Marttila <terom@fixme.fi>
Sat, 07 Feb 2009 04:37:51 +0200
changeset 23 f2940150cce5
parent 16 4a40718c7b4b
permissions -rw-r--r--
add .pyc to hgignore
"""
    Handling the list of available pages
"""

# for page_list
from page_tree import 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() if self.page else []
        
        # list of menu items == root children, since we always show the full menu...
        self.items = page_tree.root.children