Commit e5955a21 authored by Georgios Dagkakis's avatar Georgios Dagkakis

patches/ActionsTool: patch further listFilteredActionsFor to cleanup defined urls

from double slashes. This to give compatibility with definition
in actions on Web Section and Web Site portal types, for which now
absolute_url returns a trailing slash, so definitions like:

string:${object_url}/WebSection_xxx

would create a url with double slashes
parent d60a54af
......@@ -21,6 +21,7 @@ from AccessControl import ClassSecurityInfo
from Products.CMFCore.ActionsTool import ActionsTool
from Products.CMFCore.interfaces import IActionProvider
from Products.CMFCore.permissions import ManagePortal
from urlparse import urlparse, urlunparse
security = ClassSecurityInfo()
......@@ -54,8 +55,11 @@ def listFilteredActionsFor(self, object=None):
this API should be moved to listActionInfos() of each tool so as not to
create duplicate code paths that are sources of bugs.
Finally, this patch detects tools that are no longer action providers and
Also, this patch detects tools that are no longer action providers and
invokes the migration of their actions to portal_actions
Finally, this patch normalised the url defined in actions, in the case they
have double slashes
"""
actions = []
......@@ -88,6 +92,13 @@ def listFilteredActionsFor(self, object=None):
}
for action in actions:
# normalise the url defined in actions, in the case they
# have double slashes
url = action.get('url')
if isinstance(url, str):
parsed_list = list(urlparse(url))
parsed_list[2] = parsed_list[2].replace('//', '/')
action['url'] = urlunparse(parsed_list)
filtered_actions.setdefault(action['category'], []).append(action)
return filtered_actions
......
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