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
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e6872f8f
Commit
e6872f8f
authored
Mar 19, 2021
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update how to modify full_write_guard
parent
59b4c5e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+18
-2
No files found.
product/ERP5Type/patches/Restricted.py
View file @
e6872f8f
...
...
@@ -250,7 +250,10 @@ from AccessControl.ZopeGuards import _dict_white_list
# (closure) directly to ignore defaultdict like dict/list
from
RestrictedPython.Guards
import
full_write_guard
ContainerAssertions
[
defaultdict
]
=
_check_access_wrapper
(
defaultdict
,
_dict_white_list
)
#XXXfull_write_guard.func_closure[1].cell_contents.__self__[defaultdict] = True
if
isinstance
(
full_write_guard
.
func_closure
[
1
].
cell_contents
,
set
):
full_write_guard
.
func_closure
[
1
].
cell_contents
.
add
(
defaultdict
)
else
:
# BBB RestrictedPython 3.6
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
defaultdict
]
=
True
# In contrary to builtins such as dict/defaultdict, it is possible to set
# attributes on OrderedDict instances, so only allow setitem/delitem
...
...
@@ -496,7 +499,20 @@ ContainerAssertions[pd.DataFrame] = _check_access_wrapper(
# of RestrictedPython (closure) directly to allow
# write access to ndarray and pandas DataFrame.
from
RestrictedPython.Guards
import
full_write_guard
if
False
:
if
isinstance
(
full_write_guard
.
func_closure
[
1
].
cell_contents
,
set
):
full_write_guard
.
func_closure
[
1
].
cell_contents
.
update
((
np
.
ndarray
,
np
.
core
.
records
.
recarray
,
np
.
core
.
records
.
record
,
pd
.
DataFrame
,
pd
.
Series
,
pd
.
tseries
.
index
.
DatetimeIndex
,
pd
.
core
.
indexing
.
_iLocIndexer
,
pd
.
core
.
indexing
.
_LocIndexer
,
pd
.
MultiIndex
,
pd
.
Index
))
else
:
# BBB RestrictedPython 3.6
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
np
.
ndarray
]
=
True
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
np
.
core
.
records
.
recarray
]
=
True
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
np
.
core
.
records
.
record
]
=
True
...
...
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