Commit 79912214 by Bryton Lacquement

erp5_xhtml_style: do not use getToolByName to access tools

Also some code refactoring.
1 parent 9a5f3c35
"Modified version for ERP5 to append the default action (/view) in the URL."
from Products.CMFCore.utils import getToolByName
ptool = getToolByName(script, 'portal_properties')
utool = getToolByName(script, 'portal_url')
portal = context.getPortalObject()
utool = portal.portal_url
portal_url = utool()
result = []
param = int(context.REQUEST.get('ignore_layout', 0)) and '?ignore_layout:int=1' or ''
param = '?ignore_layout:int=1' if int(portal.REQUEST.get('ignore_layout', 0)) else ''
if include_root:
result.append( { 'id' : 'root'
, 'title' : ptool.title()
, 'url' : '%s/view%s' % (portal_url, param)
}
)
relative = utool.getRelativeContentPath(context)
portal = utool.getPortalObject()
result = [{
'id' : 'root',
'title' : portal.portal_properties.title(),
'url' : '%s/view%s' % (portal_url, param),
}]
else:
result = []
obj = portal
now = []
for name in relative:
for name in utool.getRelativeContentPath(context):
obj = obj.restrictedTraverse(name)
now.append(name)
title = (
getattr(obj, "getCompactTranslatedTitle", lambda: None)() or
obj.getTitle() or obj.getId()
)
if not name == 'talkback':
if name != 'talkback':
result.append( { 'id' : name
, 'title' : title
, 'url' : '%s/%s/view%s' % (portal_url, '/'.join(now), param)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!