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
Levin Zimmermann
erp5
Commits
3b17be37
Commit
3b17be37
authored
Aug 02, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: implement dummy group method
parent
1521a035
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
21 deletions
+38
-21
product/CMFActivity/ActiveObject.py
product/CMFActivity/ActiveObject.py
+0
-5
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+1
-1
product/CMFActivity/Activity/SQLDict.py
product/CMFActivity/Activity/SQLDict.py
+10
-5
product/CMFActivity/Activity/SQLQueue.py
product/CMFActivity/Activity/SQLQueue.py
+10
-5
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+10
-0
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+5
-5
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+2
-0
No files found.
product/CMFActivity/ActiveObject.py
View file @
3b17be37
...
@@ -98,11 +98,6 @@ class ActiveObject(ExtensionClass.Base):
...
@@ -98,11 +98,6 @@ class ActiveObject(ExtensionClass.Base):
new_kw
.
update
(
activate_kw
)
new_kw
.
update
(
activate_kw
)
new_kw
.
update
(
kw
)
new_kw
.
update
(
kw
)
if
kw
.
get
(
'group_id'
,
''
)
is
None
:
raise
ValueError
,
"Cannot defined a group_id with value None"
elif
kw
.
get
(
'group_method_id'
)
is
None
and
kw
.
get
(
'group_id'
)
is
not
None
:
raise
ValueError
,
"Cannot defined a group_id without group_method_id"
try
:
try
:
activity_tool
=
self
.
getPortalObject
().
portal_activities
activity_tool
=
self
.
getPortalObject
().
portal_activities
except
AttributeError
:
except
AttributeError
:
...
...
product/CMFActivity/Activity/SQLBase.py
View file @
3b17be37
...
@@ -222,7 +222,7 @@ class SQLBase:
...
@@ -222,7 +222,7 @@ class SQLBase:
activity_tool
.
SQLBase_processMessage
(
table
=
self
.
sql_table
,
uid
=
[
uid
])
activity_tool
.
SQLBase_processMessage
(
table
=
self
.
sql_table
,
uid
=
[
uid
])
uid_to_duplicate_uid_list_dict
.
setdefault
(
uid
,
[])
\
uid_to_duplicate_uid_list_dict
.
setdefault
(
uid
,
[])
\
.
extend
(
getDuplicateMessageUidList
(
line
))
.
extend
(
getDuplicateMessageUidList
(
line
))
if
group_method_id
not
in
(
None
,
''
,
'
\
0
'
)
:
if
group_method_id
!=
'
\
0
'
:
# Count the number of objects to prevent too many objects.
# Count the number of objects to prevent too many objects.
cost
=
m
.
activity_kw
.
get
(
'group_method_cost'
,
.
01
)
cost
=
m
.
activity_kw
.
get
(
'group_method_cost'
,
.
01
)
assert
0
<
cost
<=
1
,
(
self
.
sql_table
,
uid
)
assert
0
<
cost
<=
1
,
(
self
.
sql_table
,
uid
)
...
...
product/CMFActivity/Activity/SQLDict.py
View file @
3b17be37
...
@@ -66,8 +66,13 @@ class SQLDict(RAMDict, SQLBase):
...
@@ -66,8 +66,13 @@ class SQLDict(RAMDict, SQLBase):
priority_list
=
[
message
.
activity_kw
.
get
(
'priority'
,
1
)
for
message
in
registered_message_list
]
priority_list
=
[
message
.
activity_kw
.
get
(
'priority'
,
1
)
for
message
in
registered_message_list
]
dumped_message_list
=
[
self
.
dumpMessage
(
message
)
for
message
in
registered_message_list
]
dumped_message_list
=
[
self
.
dumpMessage
(
message
)
for
message
in
registered_message_list
]
date_list
=
[
message
.
activity_kw
.
get
(
'at_date'
,
None
)
for
message
in
registered_message_list
]
date_list
=
[
message
.
activity_kw
.
get
(
'at_date'
,
None
)
for
message
in
registered_message_list
]
group_method_id_list
=
[
'
\
0
'
.
join
([
message
.
activity_kw
.
get
(
'group_method_id'
,
''
),
message
.
activity_kw
.
get
(
'group_id'
,
''
)])
group_method_id_list
=
[]
for
message
in
registered_message_list
]
for
m
in
registered_message_list
:
group_method_id
=
m
.
activity_kw
.
get
(
'group_method_id'
,
''
)
if
group_method_id
is
None
:
group_method_id
=
'portal_activities/dummyGroupMethod/'
+
m
.
method_id
group_method_id_list
.
append
(
group_method_id
+
'
\
0
'
+
m
.
activity_kw
.
get
(
'group_id'
,
''
))
tag_list
=
[
message
.
activity_kw
.
get
(
'tag'
,
''
)
for
message
in
registered_message_list
]
tag_list
=
[
message
.
activity_kw
.
get
(
'tag'
,
''
)
for
message
in
registered_message_list
]
serialization_tag_list
=
[
message
.
activity_kw
.
get
(
'serialization_tag'
,
''
)
for
message
in
registered_message_list
]
serialization_tag_list
=
[
message
.
activity_kw
.
get
(
'serialization_tag'
,
''
)
for
message
in
registered_message_list
]
order_validation_text_list
=
[
self
.
getOrderValidationText
(
message
)
for
message
in
registered_message_list
]
order_validation_text_list
=
[
self
.
getOrderValidationText
(
message
)
for
message
in
registered_message_list
]
...
@@ -316,11 +321,11 @@ class SQLDict(RAMDict, SQLBase):
...
@@ -316,11 +321,11 @@ class SQLDict(RAMDict, SQLBase):
# Sort list of messages to validate the message with highest score
# Sort list of messages to validate the message with highest score
message_list
.
sort
(
key
=
sort_message_key
)
message_list
.
sort
(
key
=
sort_message_key
)
distributable_uid_set
.
add
(
message_list
[
0
].
uid
)
distributable_uid_set
.
add
(
message_list
[
0
].
uid
)
group_method_id
=
message_list
[
0
].
activity_kw
.
get
(
'group_method_id'
)
group_method_id
=
message_list
[
0
].
line
.
group_method_id
if
group_method_id
is
None
:
if
group_method_id
==
'
\
0
'
:
continue
continue
for
message
in
message_list
[
1
:]:
for
message
in
message_list
[
1
:]:
if
group_method_id
==
message
.
activity_kw
.
get
(
'group_method_id'
)
:
if
group_method_id
==
message
.
line
.
group_method_id
:
distributable_uid_set
.
add
(
message
.
uid
)
distributable_uid_set
.
add
(
message
.
uid
)
if
deletable_uid_list
:
if
deletable_uid_list
:
activity_tool
.
SQLBase_delMessage
(
table
=
self
.
sql_table
,
activity_tool
.
SQLBase_delMessage
(
table
=
self
.
sql_table
,
...
...
product/CMFActivity/Activity/SQLQueue.py
View file @
3b17be37
...
@@ -67,8 +67,13 @@ class SQLQueue(RAMQueue, SQLBase):
...
@@ -67,8 +67,13 @@ class SQLQueue(RAMQueue, SQLBase):
method_id_list
=
[
m
.
method_id
for
m
in
registered_message_list
]
method_id_list
=
[
m
.
method_id
for
m
in
registered_message_list
]
priority_list
=
[
m
.
activity_kw
.
get
(
'priority'
,
1
)
for
m
in
registered_message_list
]
priority_list
=
[
m
.
activity_kw
.
get
(
'priority'
,
1
)
for
m
in
registered_message_list
]
date_list
=
[
m
.
activity_kw
.
get
(
'at_date'
,
None
)
for
m
in
registered_message_list
]
date_list
=
[
m
.
activity_kw
.
get
(
'at_date'
,
None
)
for
m
in
registered_message_list
]
group_method_id_list
=
[
'
\
0
'
.
join
([
message
.
activity_kw
.
get
(
'group_method_id'
,
''
),
message
.
activity_kw
.
get
(
'group_id'
,
''
)])
group_method_id_list
=
[]
for
message
in
registered_message_list
]
for
m
in
registered_message_list
:
group_method_id
=
m
.
activity_kw
.
get
(
'group_method_id'
,
''
)
if
group_method_id
is
None
:
group_method_id
=
'portal_activities/dummyGroupMethod/'
+
m
.
method_id
group_method_id_list
.
append
(
group_method_id
+
'
\
0
'
+
m
.
activity_kw
.
get
(
'group_id'
,
''
))
tag_list
=
[
m
.
activity_kw
.
get
(
'tag'
,
''
)
for
m
in
registered_message_list
]
tag_list
=
[
m
.
activity_kw
.
get
(
'tag'
,
''
)
for
m
in
registered_message_list
]
serialization_tag_list
=
[
m
.
activity_kw
.
get
(
'serialization_tag'
,
''
)
for
m
in
registered_message_list
]
serialization_tag_list
=
[
m
.
activity_kw
.
get
(
'serialization_tag'
,
''
)
for
m
in
registered_message_list
]
dumped_message_list
=
[
self
.
dumpMessage
(
m
)
for
m
in
registered_message_list
]
dumped_message_list
=
[
self
.
dumpMessage
(
m
)
for
m
in
registered_message_list
]
...
@@ -255,11 +260,11 @@ class SQLQueue(RAMQueue, SQLBase):
...
@@ -255,11 +260,11 @@ class SQLQueue(RAMQueue, SQLBase):
# Sort list of messages to validate the message with highest score
# Sort list of messages to validate the message with highest score
message_list
.
sort
(
key
=
sort_message_key
)
message_list
.
sort
(
key
=
sort_message_key
)
distributable_uid_set
.
add
(
message_list
[
0
].
uid
)
distributable_uid_set
.
add
(
message_list
[
0
].
uid
)
group_method_id
=
message_list
[
0
].
activity_kw
.
get
(
'group_method_id'
)
group_method_id
=
message_list
[
0
].
line
.
group_method_id
if
group_method_id
is
None
:
if
group_method_id
==
'
\
0
'
:
continue
continue
for
message
in
message_list
[
1
:]:
for
message
in
message_list
[
1
:]:
if
group_method_id
==
message
.
activity_kw
.
get
(
'group_method_id'
)
:
if
group_method_id
==
message
.
line
.
group_method_id
:
distributable_uid_set
.
add
(
message
.
uid
)
distributable_uid_set
.
add
(
message
.
uid
)
distributable_count
=
len
(
distributable_uid_set
)
distributable_count
=
len
(
distributable_uid_set
)
if
distributable_count
:
if
distributable_count
:
...
...
product/CMFActivity/ActivityTool.py
View file @
3b17be37
...
@@ -1289,6 +1289,16 @@ class ActivityTool (Folder, UniqueObject):
...
@@ -1289,6 +1289,16 @@ class ActivityTool (Folder, UniqueObject):
if
self
.
activity_tracking
:
if
self
.
activity_tracking
:
activity_tracking_logger
.
info
(
'invoked group messages'
)
activity_tracking_logger
.
info
(
'invoked group messages'
)
security
.
declarePrivate
(
'dummyGroupMethod'
)
class
dummyGroupMethod
(
object
):
def
__bobo_traverse__
(
self
,
REQUEST
,
method_id
):
def
group_method
(
message_list
):
for
m
in
message_list
:
getattr
(
m
[
0
],
method_id
)(
*
m
[
1
],
**
m
[
2
])
del
message_list
[:]
return
group_method
dummyGroupMethod
=
dummyGroupMethod
()
def
newMessage
(
self
,
activity
,
path
,
active_process
,
def
newMessage
(
self
,
activity
,
path
,
active_process
,
activity_kw
,
method_id
,
*
args
,
**
kw
):
activity_kw
,
method_id
,
*
args
,
**
kw
):
# Some Security Cheking should be made here XXX
# Some Security Cheking should be made here XXX
...
...
product/CMFActivity/tests/testCMFActivity.py
View file @
3b17be37
...
@@ -2038,7 +2038,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2038,7 +2038,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
message_list
=
[
pickled_message
],
message_list
=
[
pickled_message
],
priority_list
=
[
1
],
priority_list
=
[
1
],
processing_node_list
=
[
-
2
],
processing_node_list
=
[
-
2
],
group_method_id_list
=
[
''
],
group_method_id_list
=
[
'
\
0
'
],
tag_list
=
[
''
],
tag_list
=
[
''
],
order_validation_text_list
=
[
''
],
order_validation_text_list
=
[
''
],
serialization_tag_list
=
[
''
],
serialization_tag_list
=
[
''
],
...
@@ -2095,7 +2095,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2095,7 +2095,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
message_list
=
[
pickled_message
],
message_list
=
[
pickled_message
],
priority_list
=
[
1
],
priority_list
=
[
1
],
processing_node_list
=
[
-
2
],
processing_node_list
=
[
-
2
],
group_method_id_list
=
[
''
],
group_method_id_list
=
[
'
\
0
'
],
tag_list
=
[
''
],
tag_list
=
[
''
],
order_validation_text_list
=
[
''
],
order_validation_text_list
=
[
''
],
serialization_tag_list
=
[
''
]
serialization_tag_list
=
[
''
]
...
@@ -2162,7 +2162,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2162,7 +2162,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
message_list
=
[
pickled_message
],
message_list
=
[
pickled_message
],
priority_list
=
[
1
],
priority_list
=
[
1
],
processing_node_list
=
[
-
2
],
processing_node_list
=
[
-
2
],
group_method_id_list
=
[
''
],
group_method_id_list
=
[
'
\
0
'
],
tag_list
=
[
''
],
tag_list
=
[
''
],
order_validation_text_list
=
[
''
],
order_validation_text_list
=
[
''
],
serialization_tag_list
=
[
''
],
serialization_tag_list
=
[
''
],
...
@@ -2220,7 +2220,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2220,7 +2220,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
message_list
=
[
pickled_message
],
message_list
=
[
pickled_message
],
priority_list
=
[
1
],
priority_list
=
[
1
],
processing_node_list
=
[
-
2
],
processing_node_list
=
[
-
2
],
group_method_id_list
=
[
''
],
group_method_id_list
=
[
'
\
0
'
],
tag_list
=
[
''
],
tag_list
=
[
''
],
order_validation_text_list
=
[
''
],
order_validation_text_list
=
[
''
],
serialization_tag_list
=
[
''
],
serialization_tag_list
=
[
''
],
...
@@ -2465,7 +2465,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2465,7 +2465,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
message_list
=
[
pickled_message
],
message_list
=
[
pickled_message
],
priority_list
=
[
1
],
priority_list
=
[
1
],
processing_node_list
=
[
-
2
],
processing_node_list
=
[
-
2
],
group_method_id_list
=
[
''
],
group_method_id_list
=
[
'
\
0
'
],
tag_list
=
[
''
],
tag_list
=
[
''
],
order_validation_text_list
=
[
''
],
order_validation_text_list
=
[
''
],
)
)
...
...
product/ERP5Catalog/CatalogTool.py
View file @
3b17be37
...
@@ -810,6 +810,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -810,6 +810,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security
.
declarePrivate
(
'uncatalogObjectList'
)
security
.
declarePrivate
(
'uncatalogObjectList'
)
def
uncatalogObjectList
(
self
,
message_list
):
def
uncatalogObjectList
(
self
,
message_list
):
"""Uncatalog a list of objects"""
"""Uncatalog a list of objects"""
# XXX: this is currently only a placeholder for further optimization
# (for the moment, it's not faster than the dummy group method)
for
obj
,
args
,
kw
in
message_list
:
for
obj
,
args
,
kw
in
message_list
:
self
.
unindexObject
(
*
args
,
**
kw
)
self
.
unindexObject
(
*
args
,
**
kw
)
del
message_list
[:]
del
message_list
[:]
...
...
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