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
Léo-Paul Géneau
erp5
Commits
89185deb
Commit
89185deb
authored
May 19, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: fix use of grouping methods from restricted Python
parent
fae04ec4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+1
-0
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+21
-0
No files found.
product/CMFActivity/ActivityTool.py
View file @
89185deb
...
...
@@ -453,6 +453,7 @@ class GroupedMessage(object):
# XXX: Allowing restricted code to implement a grouping method is questionable
# but there already exist some.
_guarded_writes
=
1
# for result
allow_class
(
GroupedMessage
)
# Activity Registration
...
...
product/CMFActivity/tests/testCMFActivity.py
View file @
89185deb
...
...
@@ -32,6 +32,7 @@ import unittest
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.Base
import
Base
from
Products.CMFActivity.ActiveObject
import
INVOKE_ERROR_STATE
from
Products.CMFActivity.Activity.Queue
import
VALIDATION_ERROR_DELAY
...
...
@@ -3102,6 +3103,26 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
finally
:
del
obj
.
__class__
.
doSomething
def
test_restrictedGroupMethod
(
self
):
skin
=
self
.
portal
.
portal_skins
.
custom
script_id
=
self
.
id
()
createZODBPythonScript
(
skin
,
script_id
,
"message_list"
,
"""if 1:
for m in message_list:
m.result = m.object.getProperty(*m.args, **m.kw)
"""
)
obj
=
self
.
portal
.
portal_activities
.
newActiveProcess
(
causality_value_list
=
(
self
.
portal
.
person_module
,
self
.
portal
.
organisation_module
))
foo
=
obj
.
activate
(
activity
=
'SQLQueue'
,
group_method_id
=
script_id
,
active_process
=
obj
.
getPath
()).
foo
foo
(
'causality'
,
portal_type
=
'Organisation Module'
)
foo
(
'stop_date'
,
'bar'
)
self
.
tic
()
self
.
assertEqual
(
sorted
(
x
.
getResult
()
for
x
in
obj
.
getResultList
()),
[
'bar'
,
'organisation_module'
])
skin
.
manage_delObjects
([
script_id
])
self
.
tic
()
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestCMFActivity
))
...
...
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