def preparePage(self, view, query): # Get all pages and order by sort index pages = dbPages.Pages.gql('ORDER BY sortIndex').fetch(1000) # Get all published page modules to be match agaisnt pages pageModules = dbPageModules.PageModules.gql('WHERE lang = :lang AND published = :published', lang = view.lang, published = True).fetch(100) # Set up memcacheid based on language memcacheid = "mainView_pageTree_%s" % (view.lang) pageTree = memcache.get(memcacheid) # If pageTree is not in memcache, build pageTree and store it in memcache if pageTree is None or self.pageRefresh: pageTree = PageService.build_tree(pages, pageModules = pageModules) memcache.set(memcacheid, pageTree, Settings.memcacheTimeout) # Set currentPage to None as a precaution view.currentPage = None # Bind pageTree to view view.pageTree = pageTree #How to get pagecontainer items footerPageContainer = dbPages.Pages.get_by_key_name('footermenu') if footerPageContainer: footerPages = dbPages.Pages.gql('WHERE parentKey = :parentKey', parentKey = footerPageContainer.key()).fetch(100) view.footerTree = PageService.build_tree(footerPages, pageRoot = footerPageContainer, pageModules = pageModules)[0] # Bind pages to view view.pages = pages
def preparePage(self, view, query): pages = dbPages.Pages.gql('ORDER BY sortIndex').fetch(1000) view.currentUser = Users.getCurrentUser() view.currentPage = None view.pageTree = PageService.build_tree(pages) view.pages = pages view.settings = Settings