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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
92cfba78
Commit
92cfba78
authored
Oct 11, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: PERF: improve getStatePermissionRolesDict and remove
a few useless methods
parent
4a3f3be4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
33 deletions
+12
-33
product/ERP5Workflow/Document/State.py
product/ERP5Workflow/Document/State.py
+0
-16
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+10
-9
product/ERP5Workflow/Tool/WorkflowTool.py
product/ERP5Workflow/Tool/WorkflowTool.py
+2
-8
No files found.
product/ERP5Workflow/Document/State.py
View file @
92cfba78
...
@@ -113,16 +113,6 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
...
@@ -113,16 +113,6 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
# return possible transition id list:
# return possible transition id list:
return
self
.
getDestinationIdList
()
return
self
.
getDestinationIdList
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getStatePermissionRolesDict'
)
def
getStatePermissionRolesDict
(
self
):
role_dict
=
getattr
(
self
,
'state_permission_roles'
,
None
)
if
role_dict
is
None
:
# PersistentMapping is required to have changes on the dict
# commited in the ZODB
self
.
state_permission_roles
=
role_dict
=
PersistentMapping
()
return
role_dict
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setStatePermissionRolesDict'
)
'setStatePermissionRolesDict'
)
def
setStatePermissionRolesDict
(
self
,
permission_roles
):
def
setStatePermissionRolesDict
(
self
,
permission_roles
):
...
@@ -141,12 +131,6 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
...
@@ -141,12 +131,6 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
"""
"""
self
.
state_permission_roles
[
permission
]
=
list
(
roles
)
self
.
state_permission_roles
[
permission
]
=
list
(
roles
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDestinationReferenceList'
)
def
getDestinationReferenceList
(
self
):
return
[
transition
.
getReference
()
for
transition
in
self
.
getDestinationValueList
()]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailableTypeList'
)
'getAvailableTypeList'
)
def
getAvailableTypeList
(
self
):
def
getAvailableTypeList
(
self
):
...
...
product/ERP5Workflow/Document/Workflow.py
View file @
92cfba78
...
@@ -227,6 +227,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -227,6 +227,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
state
=
self
.
_getWorkflowStateOf
(
document
,
id_only
=
False
)
state
=
self
.
_getWorkflowStateOf
(
document
,
id_only
=
False
)
if
state
is
not
None
:
if
state
is
not
None
:
state_permission_list
=
state
.
getAcquirePermissionList
()
state_permission_list
=
state
.
getAcquirePermissionList
()
if
hasattr
(
state
,
'getStatePermissionRolesDict'
):
for
permission
,
role_list
in
state
.
getStatePermissionRolesDict
().
items
():
for
permission
,
role_list
in
state
.
getStatePermissionRolesDict
().
items
():
# tuple means "don't acquire" in zope internal security and list
# tuple means "don't acquire" in zope internal security and list
# is used when acquisition should be done
# is used when acquisition should be done
...
...
product/ERP5Workflow/Tool/WorkflowTool.py
View file @
92cfba78
...
@@ -255,15 +255,9 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -255,15 +255,9 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
return
wfh
.
get
(
wf_id
,
None
)
return
wfh
.
get
(
wf_id
,
None
)
return
()
return
()
def
decodeWorkflowUid
(
self
,
uid
):
def
_encodeWorkflowUid
(
self
,
id
):
return
cPickle
.
loads
(
b64decode
(
uid
))
def
encodeWorkflowUid
(
self
,
id
):
return
b64encode
(
cPickle
.
dumps
(
id
))
return
b64encode
(
cPickle
.
dumps
(
id
))
def
getObjectFromPath
(
self
,
path
):
return
self
.
unrestrictedTraverse
(
path
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorkflowTempObjectList'
)
'getWorkflowTempObjectList'
)
def
getWorkflowTempObjectList
(
self
,
temp_obj
=
1
):
def
getWorkflowTempObjectList
(
self
,
temp_obj
=
1
):
...
@@ -308,7 +302,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -308,7 +302,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
new_id
=
dc_workflow
.
id
new_id
=
dc_workflow
.
id
else
:
else
:
new_id
=
'converting_'
+
dc_workflow
.
id
new_id
=
'converting_'
+
dc_workflow
.
id
uid
=
self
.
encodeWorkflowUid
(
new_id
)
uid
=
self
.
_
encodeWorkflowUid
(
new_id
)
portal_type
=
(
'Workflow'
if
workflow_type_id
==
'DCWorkflowDefinition'
else
'Interaction Workflow'
)
portal_type
=
(
'Workflow'
if
workflow_type_id
==
'DCWorkflowDefinition'
else
'Interaction Workflow'
)
workflow
=
self
.
newContent
(
id
=
new_id
,
temp_object
=
is_temporary
,
workflow
=
self
.
newContent
(
id
=
new_id
,
temp_object
=
is_temporary
,
portal_type
=
portal_type
)
portal_type
=
portal_type
)
...
...
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