Commit 177874ae authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add WebSection.getSiteMapTree()

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26265 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 089e7354
......@@ -319,3 +319,48 @@ class WebSection(Domain, PermanentURLMixIn):
cache[key] = result
return result
security.declareProtected(Permissions.View, 'getSiteMapTree')
def getSiteMapTree(self, **kw):
"""
Return a site map tree section dependent breadcrumb in the
form of a list of dicts whose structure is provided as a tree
so that it is easy to implement recursive call with TAL/METAL:
[
{
'url' : '/erp5/web_site_module/site/section',
'level' : 1,
'translated_title' : 'Section Title',
'subsection' : [
{
'url' : '/erp5/web_site_module/site/section/reference',
'level' : 2,
'translated_title' : 'Sub Section Title',
'subsection' : None,
},
...
],
}
...
]
This method must be implemented through a
portal type dependent script:
WebSection_getSiteMapTree
"""
cache = getReadOnlyTransactionCache(self)
if cache is not None:
key = ('getSiteMapTree', self) + tuple(kw.items())
try:
return cache[key]
except KeyError:
pass
result = self._getTypeBasedMethod('getSiteMapTree',
fallback_script_id='WebSection_getSiteMapTree')(**kw)
if cache is not None:
cache[key] = result
return result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment