Commit de71cc30 authored by Romain Courteaud's avatar Romain Courteaud

erp5_xhtml_style: remove probably not needed cache

parent c649ed0d
...@@ -5,7 +5,6 @@ In case of duplicate, only the first action will be kept. ...@@ -5,7 +5,6 @@ In case of duplicate, only the first action will be kept.
`actions` is the mapping returned by ActionsTool.listFilteredActionsFor `actions` is the mapping returned by ActionsTool.listFilteredActionsFor
The script must be called on the context of the document. The script must be called on the context of the document.
""" """
from Products.ERP5Type.Cache import CachingMethod
def filterDuplicateActions(actions): def filterDuplicateActions(actions):
new_actions = {} new_actions = {}
...@@ -26,29 +25,6 @@ def filterDuplicateActions(actions): ...@@ -26,29 +25,6 @@ def filterDuplicateActions(actions):
return new_actions return new_actions
def hasDuplicateActions(portal_type, user_name):
# Compare the count of action categories and actions
# Give every category a amount of 1000, as
# 'object_onlyxhtml_view' is transformed into 'object_view'
len_actions = 0
len_filtered_actions = 0
for cat in actions.values():
len_actions += 1000 + len(cat)
filtered_actions = filterDuplicateActions(actions)
for cat in filtered_actions.values():
len_filtered_actions += 1000 + len(cat)
return len_actions != len_filtered_actions
hasDuplicateActions = CachingMethod(
hasDuplicateActions,
id='Base_filterDuplicateActions.hasDuplicateActions',
cache_factory='erp5_ui_long')
user_name = getattr(container.REQUEST, 'AUTHENTICATED_USER', '')
if getattr(context, 'getPortalType', None) is not None: if getattr(context, 'getPortalType', None) is not None:
if hasDuplicateActions(context.getPortalType(), user_name):
return filterDuplicateActions(actions) return filterDuplicateActions(actions)
return actions return 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