Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
erp5
Commits
5d6d89e5
Commit
5d6d89e5
authored
May 14, 2015
by
Boris Kocherov
Committed by
Romain Courteaud
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ActionTool: add clearGetActionListCache after migration and use cacheable getActionList
parent
a38140bc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
product/ERP5Type/Tool/ActionsTool.py
product/ERP5Type/Tool/ActionsTool.py
+16
-6
No files found.
product/ERP5Type/Tool/ActionsTool.py
View file @
5d6d89e5
...
@@ -67,8 +67,10 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
...
@@ -67,8 +67,10 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
getattr
(
provider
,
'listActionInfos'
,
None
)
is
None
):
getattr
(
provider
,
'listActionInfos'
,
None
)
is
None
):
logger
.
info
(
'migrating actions from %r to %r'
,
logger
.
info
(
'migrating actions from %r to %r'
,
portal_actions_path
,
'/'
.
join
(
provider
.
getPhysicalPath
()))
portal_actions_path
,
'/'
.
join
(
provider
.
getPhysicalPath
()))
if
provider
.
_actions
:
for
old_action
in
provider
.
_actions
:
for
old_action
in
provider
.
_actions
:
self
.
_importOldAction
(
old_action
)
self
.
_importOldAction
(
old_action
)
self
.
clearGetActionListCache
()
del
provider
.
_actions
del
provider
.
_actions
if
(
getattr
(
provider
,
'listActionInfos'
,
None
)
is
None
and
if
(
getattr
(
provider
,
'listActionInfos'
,
None
)
is
None
and
getattr
(
provider
,
'getActionListFor'
,
None
)
is
None
and
getattr
(
provider
,
'getActionListFor'
,
None
)
is
None
and
...
@@ -76,9 +78,10 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
...
@@ -76,9 +78,10 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
action_providers
.
remove
(
provider_name
)
action_providers
.
remove
(
provider_name
)
self
.
action_providers
=
tuple
(
action_providers
)
self
.
action_providers
=
tuple
(
action_providers
)
security
.
declarePrivate
(
'getActionListFor'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
def
getActionListFor
(
self
,
ob
=
None
):
'getActionInformationList'
)
"""Return all actions applicable to the object"""
def
getActionInformationList
(
self
):
"""Return all Action Information objects stored on this portal type"""
old_actions
=
self
.
_actions
or
()
old_actions
=
self
.
_actions
or
()
if
old_actions
:
if
old_actions
:
LOG
(
'OldActionsTool'
,
WARNING
,
"Converting portal_actions..."
)
LOG
(
'OldActionsTool'
,
WARNING
,
"Converting portal_actions..."
)
...
@@ -87,8 +90,15 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
...
@@ -87,8 +90,15 @@ class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
self
.
_importOldAction
(
action_info
)
self
.
_importOldAction
(
action_info
)
LOG
(
'OldActionsTool'
,
WARNING
,
"... portal_actions converted."
)
LOG
(
'OldActionsTool'
,
WARNING
,
"... portal_actions converted."
)
self
.
_actions
=
()
self
.
_actions
=
()
self
.
clearGetActionListCache
()
return
ActionProviderBase
.
getActionInformationList
(
self
)
security
.
declarePrivate
(
'getActionListFor'
)
def
getActionListFor
(
self
,
ob
=
None
):
"""Return all actions applicable to the object"""
if
ob
is
not
None
:
if
ob
is
not
None
:
return
(
action
.
getCacheableAction
()
for
action
in
self
.
objectValues
()
)
return
self
.
getActionList
(
)
return
()
return
()
def
listFilteredActionsFor
(
self
,
object
=
None
):
def
listFilteredActionsFor
(
self
,
object
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment