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
138
Merge Requests
138
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
70b5d264
Commit
70b5d264
authored
Sep 05, 2024
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restricted: allow csv.
parent
2d42a55c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
...rtal_components/test.erp5.testRestrictedPythonSecurity.py
+17
-0
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+6
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
View file @
70b5d264
...
...
@@ -433,6 +433,23 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
expected
=
[(
"a"
,
1
),
(
"b"
,
2
)]
)
def
test_csv
(
self
):
self
.
createAndRunScript
(
'''
import csv
import six
from io import BytesIO, StringIO
if six.PY2:
io_ = BytesIO()
else:
io_ = StringIO()
csv_writer = csv.writer(io_)
csv_writer.writerow([1, None, 'a'])
io_.seek(0)
return io_.getvalue()
'''
,
expected
=
'1,,a
\
r
\
n
'
,
)
def
test_lax_name
(
self
):
self
.
createAndRunScript
(
'''
def _function():
...
...
product/ERP5Type/patches/Restricted.py
View file @
70b5d264
...
...
@@ -345,6 +345,12 @@ if six.PY2:
allow_type
(
cStringIO
.
OutputType
)
ModuleSecurityInfo
(
'cgi'
).
declarePublic
(
'escape'
,
'parse_header'
)
import
csv
allow_module
(
'csv'
)
temp_io
=
io
.
StringIO
()
allow_type
(
type
(
csv
.
reader
(
temp_io
)))
allow_type
(
type
(
csv
.
writer
(
temp_io
)))
del
temp_io
allow_module
(
'datetime'
)
import
datetime
ContainerAssertions
[
datetime
.
datetime
]
=
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