examples/simple_site/main.py
def _update_menus(self,change):
        """ When pages change, update the menus"""
        menus = {}
        
        #: Get all links
        links = [p.link for p in self.pages if p.link] + self.links 
        
        #: Put all links in the correct menu
        for link in links:
            for menu in link.menus:
                if menu not in menus:
                    menus[menu] = []
                menus[menu].append(link)
         
        #: Update the menus
        for name,menu in menus.items():
            k = '{}_menu'.format(name)
            if hasattr(self,k):
                setattr(self,k,menu)
def _update_menus(self,change):
        """ When pages change, update the menus"""
        menus = {}
        
        #: Get all links
        links = [p.link for p in self.pages if p.link] + self.links 
        
        #: Put all links in the correct menu
        for link in links:
            for menu in link.menus:
                if menu not in menus:
                    menus[menu] = []
                menus[menu].append(link)
         
        #: Update the menus
        for name,menu in menus.items():
            k = '{}_menu'.format(name)
            if hasattr(self,k):
                setattr(self,k,menu)
When pages change, update the menus