本文整理汇总了Python中Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy.bottomLevel方法的典型用法代码示例。如果您正苦于以下问题:Python SitemapNavtreeStrategy.bottomLevel方法的具体用法?Python SitemapNavtreeStrategy.bottomLevel怎么用?Python SitemapNavtreeStrategy.bottomLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy
的用法示例。
在下文中一共展示了SitemapNavtreeStrategy.bottomLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: siteNavStrategy
# 需要导入模块: from Products.CMFPlone.browser.navtree import SitemapNavtreeStrategy [as 别名]
# 或者: from Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy import bottomLevel [as 别名]
def siteNavStrategy(self):
context = aq_inner(self.context)
selected_tab = self.selected_portal_tab
obj = api.portal.get()[selected_tab]
path = {'query': '/'.join(obj.getPhysicalPath()),
'navtree': 1,
'navtree_start': 2,
'depth': 2}
query = {
'path': path,
'review_state': 'published',
'portal_type': ('hph.sitecontent.mainsection',
'hph.sitecontent.contentpage',
'hph.lectures.coursefolder')
}
strategy = SitemapNavtreeStrategy(obj)
strategy.rootPath = '/'.join(obj.getPhysicalPath())
strategy.showAllParents = True
strategy.bottomLevel = 999
tree = buildFolderTree(context, obj, query, strategy)
items = []
for c in tree['children']:
item = {}
item['item'] = c['item']
item['children'] = c.get('children', '')
item['itemid'] = c['normalized_id']
item_id = c['normalized_id']
if item_id == context.getId():
item['class'] = 'active'
else:
item['class'] = ''
item['parent'] = self.compute_parent_marker(item_id)
items.append(item)
return items