menu.py
author Tero Marttila <terom@fixme.fi>
Mon, 15 Jun 2009 01:44:05 +0300
changeset 52 ee1e0491b4a0
parent 46 73aef9705d6c
permissions -rw-r--r--
fix old map.MapperError reference
"""
    Handling the list of available pages
"""

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

    def __init__ (self, fs, page) :
        """
            Gather the menu information for the given page, as part of the given FilesystemMapper
        """

        # the selected page
        self.page = fs.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 = fs.tree.root.children