當前位置: 首頁>>代碼示例>>Python>>正文


Python SitemapNavtreeStrategy.rootPath方法代碼示例

本文整理匯總了Python中Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy.rootPath方法的典型用法代碼示例。如果您正苦於以下問題:Python SitemapNavtreeStrategy.rootPath方法的具體用法?Python SitemapNavtreeStrategy.rootPath怎麽用?Python SitemapNavtreeStrategy.rootPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy的用法示例。


在下文中一共展示了SitemapNavtreeStrategy.rootPath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: siteNavStrategy

# 需要導入模塊: from Products.CMFPlone.browser.navtree import SitemapNavtreeStrategy [as 別名]
# 或者: from Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy import rootPath [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
開發者ID:a25kk,項目名稱:hfph,代碼行數:36,代碼來源:navbar.py

示例2: update

# 需要導入模塊: from Products.CMFPlone.browser.navtree import SitemapNavtreeStrategy [as 別名]
# 或者: from Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy import rootPath [as 別名]
 def update(self):
     query = self.request.get('q', None)
     self.tab = self.request.get('tab', None)
     uids = None
     if self.tab == 'recent':
         pass
     elif self.tab == 'clipboard':
         brains = list(self.search(''))[:2]
         uids = [b.UID for b in brains]
     result = self.search(query, uids=uids)
     strategy = SitemapNavtreeStrategy(self.context)
     result = [strategy.decoratorFactory({'item': node}) for node in result]
     if self.tab == 'content-tree':
         portal_state = getMultiAdapter((self.context, self.request),
                                           name=u'plone_portal_state')
         portal = portal_state.portal()
         query_tree = {'sort_on': 'getObjPositionInParent',
                       'sort_order': 'asc',
                       'is_default_page': False}
         strategy.rootPath = '/Plone'
         data = buildFolderTree(portal,
                            obj=portal,
                            query=query_tree,
                            strategy=strategy)
         result = data.get('children', [])
     self.level = 1
     self.children = result
開發者ID:cintiacinquini,項目名稱:collective.cover,代碼行數:29,代碼來源:screenlets.py


注:本文中的Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy.rootPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。