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
Boris Kocherov
erp5
Commits
0f1290b3
Commit
0f1290b3
authored
Apr 06, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: code simplification
parent
09c8f83f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
product/CMFActivity/Activity/Queue.py
product/CMFActivity/Activity/Queue.py
+4
-8
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+2
-5
No files found.
product/CMFActivity/Activity/Queue.py
View file @
0f1290b3
...
...
@@ -143,12 +143,10 @@ class Queue(object):
return
EXCEPTION
return
VALID
def
getDependentMessageList
(
self
,
activity_tool
,
message
,
**
kw
):
def
getDependentMessageList
(
self
,
activity_tool
,
message
):
message_list
=
[]
for
k
,
v
in
kw
.
iteritems
():
result
=
activity_tool
.
getDependentMessageList
(
message
,
k
,
v
)
if
result
:
message_list
.
extend
(
result
)
for
k
,
v
in
message
.
activity_kw
.
iteritems
():
message_list
+=
activity_tool
.
getDependentMessageList
(
message
,
k
,
v
)
return
message_list
def
getExecutableMessageList
(
self
,
activity_tool
,
message
,
message_dict
,
...
...
@@ -174,7 +172,7 @@ class Queue(object):
cached_result
=
validation_text_dict
.
get
(
message
.
order_validation_text
)
if
cached_result
is
None
:
message_list
=
message
.
getDependentMessageList
(
self
,
activity_tool
)
message_list
=
self
.
getDependentMessageList
(
activity_tool
,
message
)
transaction
.
commit
()
# Release locks.
if
message_list
:
# The result is not empty, so this message is not executable.
...
...
@@ -197,8 +195,6 @@ class Queue(object):
message_dict
[
message
.
uid
]
=
message
elif
cached_result
:
message_dict
[
message
.
uid
]
=
message
else
:
pass
def
hasActivity
(
self
,
activity_tool
,
object
,
processing_node
=
None
,
active_process
=
None
,
**
kw
):
return
0
...
...
product/CMFActivity/ActivityTool.py
View file @
0f1290b3
...
...
@@ -308,9 +308,6 @@ class Message(BaseMessage):
check_order_validation
=
check_order_validation
,
**
self
.
activity_kw
)
def
getDependentMessageList
(
self
,
activity
,
activity_tool
):
return
activity
.
getDependentMessageList
(
activity_tool
,
self
,
**
self
.
activity_kw
)
def
notifyUser
(
self
,
activity_tool
,
retry
=
False
):
"""Notify the user that the activity failed."""
portal
=
activity_tool
.
getPortalObject
()
...
...
@@ -1422,13 +1419,13 @@ class ActivityTool (Folder, UniqueObject):
if
not
is_initialized
:
self
.
initialize
()
message_list
=
[]
method_id
=
"_validate_
%s"
%
validator_id
method_id
=
"_validate_
"
+
validator_id
for
activity
in
activity_dict
.
itervalues
():
method
=
getattr
(
activity
,
method_id
,
None
)
if
method
is
not
None
:
result
=
method
(
aq_inner
(
self
),
message
,
validation_value
)
if
result
:
message_list
.
extend
([(
activity
,
m
)
for
m
in
result
])
message_list
+=
[(
activity
,
m
)
for
m
in
result
]
return
message_list
# Required for tests (time shift)
...
...
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