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
136b64a6
Commit
136b64a6
authored
Feb 19, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restricted py3
parent
25b233d2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
product/ERP5Type/Collections.py
product/ERP5Type/Collections.py
+18
-4
product/ERP5Type/Six.py
product/ERP5Type/Six.py
+3
-2
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+2
-0
No files found.
product/ERP5Type/Collections.py
View file @
136b64a6
...
@@ -29,11 +29,25 @@ Restricted collections module.
...
@@ -29,11 +29,25 @@ Restricted collections module.
From restricted python, use "import collections" (see patches/Restricted.py).
From restricted python, use "import collections" (see patches/Restricted.py).
"""
"""
import
six
from
collections
import
(
from
collections
import
(
Counter
,
defaultdict
,
deque
,
OrderedDict
,
namedtuple
as
_namedtuple
)
Counter
,
defaultdict
,
deque
,
OrderedDict
,
namedtuple
as
_namedtuple
)
if
six
.
PY2
:
def
namedtuple
(
typename
,
field_names
,
verbose
=
False
,
rename
=
False
):
def
namedtuple
(
typename
,
field_names
,
verbose
=
False
,
rename
=
False
):
ret
=
_namedtuple
(
typename
,
field_names
,
verbose
,
rename
)
ret
=
_namedtuple
(
typename
,
field_names
,
verbose
,
rename
)
ret
.
__allow_access_to_unprotected_subobjects__
=
1
ret
.
__allow_access_to_unprotected_subobjects__
=
1
return
ret
return
ret
else
:
def
namedtuple
(
typename
,
field_names
,
rename
=
False
,
defaults
=
None
,
module
=
None
):
ret
=
_namedtuple
(
typename
,
field_names
,
rename
=
rename
,
defaults
=
defaults
,
module
=
module
)
ret
.
__allow_access_to_unprotected_subobjects__
=
1
return
ret
product/ERP5Type/Six.py
View file @
136b64a6
...
@@ -48,5 +48,6 @@ from AccessControl.ZopeGuards import SafeIter
...
@@ -48,5 +48,6 @@ from AccessControl.ZopeGuards import SafeIter
iterkeys
=
lambda
d
:
SafeIter
(
_six
.
iterkeys
(
d
),
d
)
iterkeys
=
lambda
d
:
SafeIter
(
_six
.
iterkeys
(
d
),
d
)
itervalues
=
lambda
d
:
SafeIter
(
_six
.
itervalues
(
d
),
d
)
itervalues
=
lambda
d
:
SafeIter
(
_six
.
itervalues
(
d
),
d
)
from
AccessControl.ZopeGuards
import
safe_builtins
as
_safe_builtins
if
PY2
:
_safe_builtins
[
'xrange'
]
=
_six
.
moves
.
xrange
from
AccessControl.ZopeGuards
import
safe_builtins
as
_safe_builtins
_safe_builtins
[
'xrange'
]
=
_six
.
moves
.
xrange
product/ERP5Type/patches/Restricted.py
View file @
136b64a6
...
@@ -385,6 +385,8 @@ import six.moves.urllib.parse
...
@@ -385,6 +385,8 @@ import six.moves.urllib.parse
allow_module
(
'six.moves.urllib.parse'
)
allow_module
(
'six.moves.urllib.parse'
)
allow_type
(
six
.
moves
.
urllib
.
parse
.
ParseResult
)
allow_type
(
six
.
moves
.
urllib
.
parse
.
ParseResult
)
allow_type
(
six
.
moves
.
urllib
.
parse
.
SplitResult
)
allow_type
(
six
.
moves
.
urllib
.
parse
.
SplitResult
)
# BBB this is different type on python3
allow_type
(
type
(
six
.
moves
.
urllib
.
parse
.
urldefrag
(
''
)))
ModuleSecurityInfo
(
'six.moves.urllib.parse'
).
declarePublic
(
ModuleSecurityInfo
(
'six.moves.urllib.parse'
).
declarePublic
(
'urlencode'
,
'urlencode'
,
'quote'
,
'unquote'
,
'quote'
,
'unquote'
,
...
...
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