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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
772e6aae
Commit
772e6aae
authored
May 19, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: ActivityRuntimeEnvironment for grouped messages WIP
parent
7d7a5f6c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndex.py
...atalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndex.py
+1
-0
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+6
-3
product/CMFActivity/ActivityRuntimeEnvironment.py
product/CMFActivity/ActivityRuntimeEnvironment.py
+15
-7
No files found.
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndex.py
View file @
772e6aae
...
@@ -20,6 +20,7 @@ for document in getPath:
...
@@ -20,6 +20,7 @@ for document in getPath:
document
,
document
,
activity
=
'SQLDict'
,
activity
=
'SQLDict'
,
priority
=
priority
,
priority
=
priority
,
tag
=
context
.
getActivityRuntimeEnvironment
().
getTagForPath
(
document
),
node
=
'same'
,
node
=
'same'
,
group_method_id
=
GROUP_METHOD_ID
,
group_method_id
=
GROUP_METHOD_ID
,
group_method_cost
=
group_method_cost
,
group_method_cost
=
group_method_cost
,
...
...
product/CMFActivity/Activity/SQLBase.py
View file @
772e6aae
...
@@ -834,14 +834,17 @@ CREATE TABLE %s (
...
@@ -834,14 +834,17 @@ CREATE TABLE %s (
args
=
(
group_method_id
,
message_list
,
self
.
__class__
.
__name__
,
args
=
(
group_method_id
,
message_list
,
self
.
__class__
.
__name__
,
hasattr
(
self
,
'generateMessageUID'
))
hasattr
(
self
,
'generateMessageUID'
))
activity_runtime_environment
=
ActivityRuntimeEnvironment
(
activity_runtime_environment
=
ActivityRuntimeEnvironment
(
None
,
message_list
,
priority
=
min
(
x
.
line
.
priority
for
x
in
message_list
)
,
is_grouped_activity
=
True
,
)
)
else
:
else
:
method
=
activity_tool
.
invoke
method
=
activity_tool
.
invoke
message
,
=
message_list
message
,
=
message_list
args
=
message_list
args
=
message_list
activity_runtime_environment
=
ActivityRuntimeEnvironment
(
message
)
activity_runtime_environment
=
ActivityRuntimeEnvironment
(
message_list
,
is_grouped_activity
=
False
,
)
# Commit right before executing messages.
# Commit right before executing messages.
# As MySQL transaction does not start exactly at the same time as ZODB
# As MySQL transaction does not start exactly at the same time as ZODB
# transactions but a bit later, messages available might be called
# transactions but a bit later, messages available might be called
...
...
product/CMFActivity/ActivityRuntimeEnvironment.py
View file @
772e6aae
...
@@ -41,9 +41,10 @@ class BaseMessage:
...
@@ -41,9 +41,10 @@ class BaseMessage:
class
ActivityRuntimeEnvironment
(
object
):
class
ActivityRuntimeEnvironment
(
object
):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
def
__init__
(
self
,
message
,
priority
=
None
):
def
__init__
(
self
,
message
_list
,
is_grouped_activity
):
self
.
_message
=
message
self
.
_message
_list
=
message_list
self
.
_priority
=
priority
self
.
_priority
=
priority
self
.
_is_grouped_activity
=
is_grouped_activity
def
__enter__
(
self
):
def
__enter__
(
self
):
assert
not
hasattr
(
_activity_runtime_environment
,
'value'
)
assert
not
hasattr
(
_activity_runtime_environment
,
'value'
)
...
@@ -55,17 +56,24 @@ class ActivityRuntimeEnvironment(object):
...
@@ -55,17 +56,24 @@ class ActivityRuntimeEnvironment(object):
security
.
declarePublic
(
'getTag'
)
security
.
declarePublic
(
'getTag'
)
def
getTag
(
self
,
default
=
None
):
def
getTag
(
self
,
default
=
None
):
return
self
.
_message
.
activity_kw
.
get
(
'tag'
,
default
)
if
self
.
_is_grouped_activity
:
raise
ValueError
(
"Operation not supported on grouped activities"
)
return
self
.
_message_list
[
0
].
activity_kw
.
get
(
'tag'
,
default
)
security
.
declarePublic
(
'getTagForPath'
)
def
getTagForPath
(
self
,
path
,
default
=
None
):
for
message
in
self
.
_message_list
:
if
message
.
path
==
path
:
return
message
.
activity_kw
.
get
(
'tag'
,
default
)
return
default
security
.
declarePublic
(
'getPriority'
)
security
.
declarePublic
(
'getPriority'
)
def
getPriority
(
self
):
def
getPriority
(
self
):
result
=
self
.
_priority
return
min
(
message
.
priority
for
message
in
self
.
_message_list
)
if
result
is
None
:
return
self
.
_message
.
line
.
priority
return
result
security
.
declarePublic
(
'edit'
)
security
.
declarePublic
(
'edit'
)
def
edit
(
self
,
**
kw
):
def
edit
(
self
,
**
kw
):
# TODO: supported grouped activities
# There is no point allowing to modify other attributes from a message
# There is no point allowing to modify other attributes from a message
for
k
in
kw
:
for
k
in
kw
:
getattr
(
BaseMessage
,
k
)
getattr
(
BaseMessage
,
k
)
...
...
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