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
f416dfbe
Commit
f416dfbe
authored
Jan 27, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/Restricted: allow collections.namedtuple
parent
d9d1caa3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+2
-0
product/ERP5Type/tests/testRestrictedPythonSecurity.py
product/ERP5Type/tests/testRestrictedPythonSecurity.py
+8
-0
No files found.
product/ERP5Type/patches/Restricted.py
View file @
f416dfbe
...
@@ -205,6 +205,8 @@ ContainerAssertions[Counter] = _check_access_wrapper(Counter, _counter_white_lis
...
@@ -205,6 +205,8 @@ ContainerAssertions[Counter] = _check_access_wrapper(Counter, _counter_white_lis
Counter
.
__guarded_setitem__
=
dict
.
__setitem__
Counter
.
__guarded_setitem__
=
dict
.
__setitem__
Counter
.
__guarded_delitem__
=
dict
.
__delitem__
Counter
.
__guarded_delitem__
=
dict
.
__delitem__
ModuleSecurityInfo
(
'collections'
).
declarePublic
(
'namedtuple'
)
# given as example in Products.PythonScripts.module_access_examples
# given as example in Products.PythonScripts.module_access_examples
allow_module
(
'base64'
)
allow_module
(
'base64'
)
allow_module
(
'binascii'
)
allow_module
(
'binascii'
)
...
...
product/ERP5Type/tests/testRestrictedPythonSecurity.py
View file @
f416dfbe
...
@@ -145,3 +145,11 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
...
@@ -145,3 +145,11 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
'return c.most_common(1)'
,
'return c.most_common(1)'
,
expected
=
[(
'a'
,
3
)]
expected
=
[(
'a'
,
3
)]
)
)
def
test_collections_namedtuple
(
self
):
self
.
createAndRunScript
(
'from collections import namedtuple'
,
'Object = namedtuple("Object", ["a", "b", "c"])'
,
'return Object(a=1, b=2, c=3).a'
,
expected
=
1
)
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