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
Laurent S
erp5
Commits
e9a6abf0
Commit
e9a6abf0
authored
May 21, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow consumption of generator in restricted python
parent
c81dc222
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+20
-0
No files found.
product/ERP5Type/patches/Restricted.py
View file @
e9a6abf0
...
...
@@ -136,6 +136,26 @@ ContainerAssertions[set] = _check_set_access
ContainerAssertions
[
frozenset
]
=
1
_generator_type
=
type
((
x
for
x
in
[]))
_generator_white_list
=
{
'next'
:
1
}
def
_check_generator_access
(
name
,
value
):
# Check whether value is a dict method
self
=
getattr
(
value
,
'__self__'
,
None
)
if
self
is
None
:
# item
return
1
# Disallow spoofing
if
type
(
self
)
is
not
_generator_type
:
return
0
if
getattr
(
value
,
'__name__'
,
None
)
!=
name
:
return
0
return
_generator_white_list
.
get
(
name
,
0
)
ContainerAssertions
[
_generator_type
]
=
_check_generator_access
from
collections
import
OrderedDict
OrderedDict
.
__allow_access_to_unprotected_subobjects__
=
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