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
Paul Graydon
erp5
Commits
506904df
Commit
506904df
authored
2 years ago
by
Arnaud Fontaine
Committed by
Aurel
2 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: patches/Restricted: Port to Python3.
parent
3687ac8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+9
-3
No files found.
product/ERP5Type/patches/Restricted.py
View file @
506904df
...
@@ -282,7 +282,7 @@ def allow_full_write(t):
...
@@ -282,7 +282,7 @@ def allow_full_write(t):
# (closure) directly to allow write access (using __setattr__ and __delattr__)
# (closure) directly to allow write access (using __setattr__ and __delattr__)
# to ndarray and pandas DataFrame below.
# to ndarray and pandas DataFrame below.
from
RestrictedPython.Guards
import
full_write_guard
from
RestrictedPython.Guards
import
full_write_guard
safetype
=
full_write_guard
.
func_closure
[
1
].
cell_contents
safetype
=
full_write_guard
.
__closure__
[
1
].
cell_contents
if
isinstance
(
safetype
,
set
):
# 5.1
if
isinstance
(
safetype
,
set
):
# 5.1
safetype
.
add
(
t
)
safetype
.
add
(
t
)
else
:
# 3.6
else
:
# 3.6
...
@@ -296,9 +296,15 @@ from RestrictedPython.Guards import full_write_guard
...
@@ -296,9 +296,15 @@ from RestrictedPython.Guards import full_write_guard
ContainerAssertions
[
defaultdict
]
=
_check_access_wrapper
(
defaultdict
,
_dict_white_list
)
ContainerAssertions
[
defaultdict
]
=
_check_access_wrapper
(
defaultdict
,
_dict_white_list
)
allow_full_write
(
defaultdict
)
allow_full_write
(
defaultdict
)
# On Python2 only: In contrary to builtins such as dict/defaultdict, it is
# possible to set attributes on OrderedDict instances, so only allow
# setitem/delitem
ContainerAssertions
[
OrderedDict
]
=
_check_access_wrapper
(
OrderedDict
,
_dict_white_list
)
ContainerAssertions
[
OrderedDict
]
=
_check_access_wrapper
(
OrderedDict
,
_dict_white_list
)
OrderedDict
.
__guarded_setitem__
=
OrderedDict
.
__setitem__
.
__func__
if
six
.
PY2
:
OrderedDict
.
__guarded_delitem__
=
OrderedDict
.
__delitem__
.
__func__
OrderedDict
.
__guarded_setitem__
=
OrderedDict
.
__setitem__
.
__func__
OrderedDict
.
__guarded_delitem__
=
OrderedDict
.
__delitem__
.
__func__
else
:
allow_full_write
(
OrderedDict
)
_counter_white_list
=
copy
.
copy
(
_dict_white_list
)
_counter_white_list
=
copy
.
copy
(
_dict_white_list
)
_counter_white_list
[
'most_common'
]
=
1
_counter_white_list
[
'most_common'
]
=
1
...
...
This diff is collapsed.
Click to expand it.
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